Skip to main content

It is inspired from Ruby’s RSpec. Spec definition is based on Python decorator description.

Features

  • Python decorator based “Spec” definition

  • “Spec” definition is compatible with unittest.TestCase

  • Spec files can execute with unittest or nosetests

  • RSpec like Expectation (e.g. the[xxx].should.be[yyy])

  • Decorator based “Mock” object definition

  • All features can be used independently: e.g. use spec with nose.tools

  • Markdown document generator from spec file

  • Single code implementation for multi python version (2.5-2.7, 3.1)

Spec Example

# examples/sum_spec.py
from specfor import the, spec

empty_list = spec.of("empty list")
int_list = spec.of("int list")

@empty_list.before()
def prepare(its):
    its.list = []
    its.sum = 0

@int_list.before()
def prepare(its):
    its.list = [2, 3, 5, 7, 11]
    its.sum = 28

@empty_list.that("sum")
@int_list.that("sum")
def sum_spec(its):
    result = sum(its.list)
    the[result].should == its.sum

spec.publish(globals())

For more detail, see README.md

Metadata

Release files for python-specfor 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-specfor 0.1.0
File Size Uploaded Provenance Actions
python-specfor-0.1.0.tar.gz 23.0 kB Without provenance Details for python-specfor-0.1.0.tar.gz

Release files / python-specfor-0.1.0.tar.gz

Download URL python-specfor-0.1.0.tar.gz
Size 23.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e560aea9cf7210a1832431f1421d733c1d18ac29aaffcdc99ad6555c46df5947
BLAKE2b-256 checksum
How to use checksums
a9cacd846a0edb7767c610f7c0c95b118fd07d63162a832e62da4a149db99745
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for python-specfor 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page