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 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

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

Uploaded Source

Built Distribution

ycontract-0.1.8-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

Hashes for ycontract-0.1.8.tar.gz
Algorithm Hash digest
SHA256 eaf1c6d104ff9e1ca7aacacc041f23445281d27b3d0b4c4a4a20564d1cf318fa
MD5 fbf43bb097b92bbb5cc7dfb34a705556
BLAKE2b-256 fa9bbcdc44cb9d5e7ebf30cdd5c98ea68924482e93f5cc9dad27a40aee3cc9ce

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ycontract-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 7.1 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.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 e9ba96889722407c35064a9e4aafa30048ccb2b255557004c7137f2d574a57a7
MD5 2d6d001ea27a8cc4efbbb90a78b42dc9
BLAKE2b-256 2d8e7281f9159743459251e64e53e4f5d780078bd13661cd5422681609753739

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