Skip to main content

Python library for contracts testing

Project description

ycontract

PyPI PyPI - Python Version pipeline status coverage report PyPI - License

Python library for contracts testing.

This library provides functions for checking argument(in_contract) and return value(out_contract) of a function.

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

Apache 2.0

Project details


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.2.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

ycontract-0.2.1.2-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file ycontract-0.2.1.2.tar.gz.

File metadata

  • Download URL: ycontract-0.2.1.2.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

Hashes for ycontract-0.2.1.2.tar.gz
Algorithm Hash digest
SHA256 3d4021ccab5663f1750c33c60236821d897fbb49dfa7fd59dce4d777af7e7921
MD5 56d4f1ea245ab3ca5ad0161c47244621
BLAKE2b-256 204502ec99a6ccbc4ce03f25340b30b30b23c5ca70d7a3860fbe47dd4e565cc4

See more details on using hashes here.

File details

Details for the file ycontract-0.2.1.2-py3-none-any.whl.

File metadata

  • Download URL: ycontract-0.2.1.2-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

Hashes for ycontract-0.2.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2365ea5078988057ad8add81cffe9e9b2a0e8342ed22d2279a9fb846fb0758d3
MD5 4a7df0ecd893fe83a02d3f1775c793ea
BLAKE2b-256 711a8cf4eb305463c0cd48a969590cec86abc4a608b01b1a173c08ad41e7481a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page