Edge Python
Esc

Go to

Commands

Sign In

Sign in to publish packages and pin them by sha256.


By continuing, you accept our Terms and Conditions.

@
Palette

test

0.1.1

Fixtures, assertions and a runner for Edge Python tests.

@dylan·1 downloads·6.3 KB·needs edge 0.7.5·Repository
edge add test && edge lock
bash

sha256-26ea10d7e4ddc0e4bd3da4ab8796da7879c327978bb218371dd488669acabee8

Docs

test

test is a unit-test harness written in Edge Python. Tests register with decorators, fixtures are injected by keyword, and run() reports each test and exits with a code a runner can read.

pass. user has a name
pass. division by zero raises
2 passed, 0 failed
Output

@fixture registers a factory under its function’s name. Every test that names it gets a fresh one, so no test leaks state into another. @test(description, *uses) registers a test and the fixtures it takes.

raises(exc_type, match=None) asserts that the block raises exc_type, a class or a tuple of classes. With match the message must also contain that text, so the right exception raised for the wrong reason still fails.

pass. rejects negatives
1 passed, 0 failed
Output

run() prints a pass., fail. or error. line per test and a summary, then raises SystemExit(1) if anything failed and SystemExit(0) otherwise. A failed assertion carries its message. edge test drives what a file registered, so a test file needs no run() of its own.

pass. two plus two
fail. this one fails (AssertionError: letter missing)
1 passed, 1 failed
Output

edge test finds every *_test.py file and reads each verdict from that exit code.

Versions

VersionPublishedSize
0.1.1currentSeptember 29, 20266.3 KB
0.1.0September 28, 20265.9 KB