Skip to main content

Should-DSL: Improve readability for should-style expectations

The goal of Should-DSL is to write should expectations in Python as clear and readable as possible, using “almost” natural language (limited - sometimes - by the Python language constraints).

In order to use this DSL, you need to import should and should_not objects from should_dsl module.

For example:

>>> from should_dsl import should

>>> 1 |should| equal_to(1)
>>> 'should' |should| include('oul')
>>> 3 |should| be_into([0, 1, 2])
Traceback (most recent call last):
...
ShouldNotSatisfied: 3 is not into [0, 1, 2]

The equal_to matcher verifies object equality. If you want to ensure identity, you must use be as matcher:

>>> 2 |should| be(2)

A nice example of exceptions would be:

>>> def raise_zerodivisionerror():
...     return 1/0
>>> raise_zerodivisionerror |should| throw(ZeroDivisionError)

should has a negative version: should_not:

>>> from should_dsl import should_not

>>> 2 |should_not| be_into([1, 3, 5])
>>> 'should' |should_not| include('oul')
Traceback (most recent call last):
...
ShouldNotSatisfied: 'should' does include 'oul'

Metadata

Release files for should_dsl 2.1.2

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

Source distribution (sdist)

Source distribution for should_dsl 2.1.2
File Size Uploaded Provenance
should_dsl-2.1.2.tar.gz 13.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for should_dsl 2.1.2
File Interpreter ABI Platform
should_dsl-2.1.2-py2.7.egg Legacy Egg format - - Details

Total release size: 35.1 kB

Release files / should_dsl-2.1.2.tar.gz

Download URL should_dsl-2.1.2.tar.gz
Size 13.7 kB
Tags Source
SHA-256 checksum
How to use checksums
36f753d90fbdf84ef2b7a9e07813e3efac725376feb7a793549f3fff7a03232a
BLAKE2b-256 checksum
How to use checksums
a3f0fa86e6065ca706dd0f9c4e2ab4d0dc0073641dd110615812a62d00ce4f50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / should_dsl-2.1.2-py2.7.egg

Download URL should_dsl-2.1.2-py2.7.egg
Size 21.4 kB
Tags Egg
SHA-256 checksum
How to use checksums
6fb6c77675024dd7334a5c66efb78211d42c68f10470e102784a8d46507fd8c1
BLAKE2b-256 checksum
How to use checksums
0efd662d58c028bb806aa56e6ab6aa548438ccda669769dced820e0c06ee22f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for should_dsl 2.1.2

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.

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