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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: ycontract-0.1.4.tar.gz
  • Upload date:
  • Size: 6.7 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.4.tar.gz
Algorithm Hash digest
SHA256 12219d5962d960636d98fa6b5a3e469d604c62fd3e9466ad85740a5c1738ebf7
MD5 82d774b0581b99076576f26184df804a
BLAKE2b-256 f4c802f6e398f419ef3215ebfaba08f51c1e4dd7c27e8f0cfec210b9d67e7cb0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ycontract-0.1.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7a351cf48be949d7c03e391fbb33c30938b8314aef6b9266bb838007df6dbefb
MD5 d0068d559add3502d77f591f0d8787c5
BLAKE2b-256 77e00e760a30148f12c18996eb79f04c46caa6d1edd3b56e8fbddb808cac7119

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