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

Uploaded Source

Built Distribution

ycontract-0.2.1.1-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

Hashes for ycontract-0.2.1.1.tar.gz
Algorithm Hash digest
SHA256 2c7043bc94c1eee2250abb7e7e9e47cfd67f8d40ecd6002c14bf16261a9b9bf4
MD5 4184b7bfc26382e36807135ca5496d11
BLAKE2b-256 8df0c82a660f07ce9069b700bfe9846dbbda7128e2ac4f224f7660fd84d830df

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ycontract-0.2.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.5 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 43544c9a9d3053570a88c0430380a6e0b34847b06d8aca353ed3b7ff1c412e74
MD5 574fc77c25dc0cb590821d2d71191c94
BLAKE2b-256 db60dc995366cba0efaa26981adb93b694b4b511c3655e35c063f8369d857d96

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