Baby Steps
BDD steps for test markup. Just for readability.
Installation
pip3 install baby-steps
Usage
import httpx
from baby_steps import given, when, then
def test_status_code():
with given:
code = 200
with when:
resp = httpx.get(f"https://httpbin.org/status/{code}")
with then:
assert resp.status_code == code
Named Steps
import httpx
from baby_steps import given, when, then
def test_status_code():
with given("status code"):
code = 200
with when("user requests a resource"):
resp = httpx.get(f"https://httpbin.org/status/{code}")
with then("it should return expected status code"):
assert resp.status_code == code
Hooks
from baby_steps import given, then, when
from baby_steps.hooks import add_hook
def test():
with given("status code"):
pass
with when("user requests a resource"):
pass
with then("it should return expected status code"):
pass
def hook(step, name):
print(step, name)
add_hook(hook)
test()
# <class 'baby_steps.Given'> 'status code'
# <class 'baby_steps.When'> 'user requests a resource'
# <class 'baby_steps.Then'> 'it should return expected status code'
Advanced
from baby_steps import when
from baby_steps.hooks import add_hook
def test():
with when:
print("when")
def hook(step, name):
print("before", step)
yield
print("after", step)
add_hook(hook)
test()
# before <class 'baby_steps.When'>
# when
# after <class 'baby_steps.When'>
Custom Steps
from baby_steps import Step
class AndThen(Step):
pass
and_then = AndThen()
with and_then("smth"):
pass
Metadata
Release files for baby-steps 1.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| baby_steps-1.3.1.tar.gz | 8.0 kB | Without provenance | Details for baby_steps-1.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| baby_steps-1.3.1-py3-none-any.whl | Python 3 | none | any | Details for baby_steps-1.3.1-py3-none-any.whl |
Total release size: 15.5 kB
Release files / baby_steps-1.3.1.tar.gz
| Download URL | baby_steps-1.3.1.tar.gz |
|---|---|
| Size | 8.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4312f88e8d92a7a7b9a070b32a114ea6d8c432e6a10e4c8b2163a6bcc2461036
|
|
BLAKE2b-256 checksum How to use checksums |
d017c1bac3b57488801455ff8228f8c18107cbe5f4233c4b1e713fdb86e40f62
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.11.9
|
Release files / baby_steps-1.3.1-py3-none-any.whl
| Download URL | baby_steps-1.3.1-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0409b453ff5dc2d0830f058b5241a06475534f32337be0a192497085347ac820
|
|
BLAKE2b-256 checksum How to use checksums |
6b75cd931faf5df31683d1b4c12c663147b4ca7315bf6ed484b34ab362452506
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.11.9
|
Security for baby-steps 1.3.1
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.