Skip to main content

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

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 add(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,

ycontract.SYS_STATE.disable()

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.3.tar.gz (6.6 kB view hashes)

Uploaded Source

Built Distribution

ycontract-0.1.3-py3-none-any.whl (6.8 kB view hashes)

Uploaded Python 3

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