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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: ycontract-0.1.3.tar.gz
  • Upload date:
  • Size: 6.6 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.3.tar.gz
Algorithm Hash digest
SHA256 d20e4d249311ecbfe0ac59b4d992dcfa24663fe830dc2590f706f7cd7006f2ba
MD5 cf092a9acfbfc902f5497653c9275fe3
BLAKE2b-256 3e6b6898c9e671a01a2d212eec75003cb64db3a13dfafd4149f16f33849b04b8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ycontract-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 6.8 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8e9182c58576504ccaa4c4e47e55a4686cdec7777da78c6f8660d2ed52cf441c
MD5 97640519f87d687b4ab89cc512d0964b
BLAKE2b-256 5dd505d57af6450f2e2b6c9a82b8d30a3a0ce2cdb9cbdd81ef1696791a465f09

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