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.disable_contract()
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.7.tar.gz
(6.8 kB
view details)
Built Distribution
File details
Details for the file ycontract-0.1.7.tar.gz
.
File metadata
- Download URL: ycontract-0.1.7.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.9 CPython/3.7.0 Darwin/19.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aba1ff3cbb35b226af6e313bea1f505ed89760b01edcc62fda3883589d346c06 |
|
MD5 | 863956a795816c005cd4857e12548667 |
|
BLAKE2b-256 | 40f724d5a7b5389938dfc21a7d4944218e5ac0c2e9700126dd61027f8ce1b57f |
File details
Details for the file ycontract-0.1.7-py3-none-any.whl
.
File metadata
- Download URL: ycontract-0.1.7-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.9 CPython/3.7.0 Darwin/19.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e81d2800546377b322dda42063bf43c37536c77f3b8803a29698f191be77138e |
|
MD5 | 41c427011165a3719a2d8740161690a9 |
|
BLAKE2b-256 | 775d6002c9825e1c85aa677a5ba458223cd239bdf8b717ea01ed5165b0d90a6c |