Python library for contracts testing
Project description
ycontract
Python library for contracts testing.
This library provides functions for precondition(in_contract
) and postcondition(out_contract
).
How to install
$ pip install ycontract
Example
Example files are here(test file)
Main example is
from ycontract import in_contract, out_contract
@in_contract(lambda a, b: a * b > 0)
def add(a, b, c, d=2, e=3):
return a + b + c + d + e
@out_contract(lambda res: res > 0)
def sub(a, b):
return a - b
And if you want to be disable, call
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.2.1.tar.gz
(7.3 kB
view details)
Built Distribution
File details
Details for the file ycontract-0.2.1.tar.gz
.
File metadata
- Download URL: ycontract-0.2.1.tar.gz
- Upload date:
- Size: 7.3 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 | ab2c6ec7e69cf29010d01a32b96727f69ba2aa2ec419ca1f471573f43a4258ef |
|
MD5 | f7ea6ef3bc51c538abc33718d0cc7fa5 |
|
BLAKE2b-256 | 54de09545c56654f04c4f1db50d068759eabb6f0cb7ab65cbafecf88b43ebf03 |
File details
Details for the file ycontract-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: ycontract-0.2.1-py3-none-any.whl
- Upload date:
- Size: 7.4 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 | f47e48cad4640d443b5ab7d3b1aadc297a8a28545531c83621c144029f5bd574 |
|
MD5 | 6bc12a38819ac0d9aa545ce0cda0dcf6 |
|
BLAKE2b-256 | 4f19b4cbf786edfeb395360800fee80ae630cf16cfe1a41674e7d0dac697f846 |