Python library for contracts testing
Project description
ycontract
Python library for contracts testing.
This library provides functions for precondition(prev_contract
) and postcondition(ret_contract
).
How to install
$ pip install ycontract
Example
Example files are here(test file)
Main example is
from ycontract import prev_contract, ret_contract
@prev_contract(lambda a, b: a * b > 0)
def add(a, b, c, d=2, e=3):
return a + b + c + d + e
@ret_contract(lambda res: res > 0)
def sub(a, b):
return a - b
And if you want to be disable,
ycontract.SYS_STATE.disable()
LICENSES
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ycontract-0.1.6.tar.gz
(6.8 kB
view hashes)
Built Distribution
Close
Hashes for ycontract-0.1.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb8c4944ca52a829371ddd5a5d58bdaeeb2c249daf90fbf5526ae936fe927de4 |
|
MD5 | d0c18fcd349e011ee4ec0b2579c0593d |
|
BLAKE2b-256 | 1caabe3fc593571741b2f3551b8167d6cef2a6908e4d31cf9a9b7167d7852c53 |