niltestDeveloper tool
Documentation
EN
GitHub

PYTHON · ZERO DEPENDENCIES · MIT

Executable specifications,
beside your code.

Write behavior once and reuse it as documentation, tests, and development mocks. Start with one function and grow from there.

Get started
pip install niltest
0 runtime deps2 API styles3 modes
shipping.pyExecutable specification
python
from niltest import case, docs, scenario

@scenario("Shipping fee")
@docs(case("Premium member", given={"premium": True}, returns=0))
def shipping_fee(premium: bool) -> int:
    return 0 if premium else 500

ONE SOURCE OF TRUTH

Use one case across your development workflow.

Stop maintaining separate examples for documentation, test inputs, and mock return values.

Specification

Reviewable behavior beside the implementation

Concrete inputs and outcomes make intent visible without forcing readers to infer it from implementation details.

Explore the concepts
Mock

Move forward without external services

Reuse the same cases as fixed development mocks.

Explore mocking
Test

Check the implementation immediately

Run declared cases against the real function.

Explore testing
Production

Keep development support out of the production path

The declaration API returns your original function in production.

Explore production mode

START SMALL

Begin with one function.

No configuration file and no runtime dependencies. Adopt niltest gradually in an existing project.

Install niltestView on GitHub