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, 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.0.tar.gz
(7.0 kB
view details)
Built Distribution
File details
Details for the file ycontract-0.2.0.tar.gz
.
File metadata
- Download URL: ycontract-0.2.0.tar.gz
- Upload date:
- Size: 7.0 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 | e3ec2bea2a364f14c154c9d131bb0a3f4c7c2bc17d1ce57237004d274551a536 |
|
MD5 | d5e48dba8de20fe6618dc283ec2958d2 |
|
BLAKE2b-256 | 0807f8e952cdb4b1b019e7c267c955bd1843c10dafcfc940316658bbaf384dda |
File details
Details for the file ycontract-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: ycontract-0.2.0-py3-none-any.whl
- Upload date:
- Size: 7.2 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 | f11abccd7183992e67cbb874b8c2380de44bd6c7810362d1373f251a01ba8d45 |
|
MD5 | 2c89d95b7cb97a6a68f5c486b8558085 |
|
BLAKE2b-256 | ded7d157d4250ca307e9b0cc6ff880b4f596d5c92f21de409f4c7d29e8dcc728 |