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

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

Uploaded Source

Built Distribution

ycontract-0.1.6-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ycontract-0.1.6.tar.gz
  • Upload date:
  • Size: 6.8 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.6.tar.gz
Algorithm Hash digest
SHA256 85f0fb64a9199eb24839563602afdea591ac73c6872476d26fefb530a247fedf
MD5 2079929bd2e619607e561ae93d9a9fab
BLAKE2b-256 1b37e45812c857ace203e53f84555ec36394edc343d93ed4badc4a204c80c676

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ycontract-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 6.9 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 eb8c4944ca52a829371ddd5a5d58bdaeeb2c249daf90fbf5526ae936fe927de4
MD5 d0c18fcd349e011ee4ec0b2579c0593d
BLAKE2b-256 1caabe3fc593571741b2f3551b8167d6cef2a6908e4d31cf9a9b7167d7852c53

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