Skip to main content

Contracts for Python

Project description

Contracts for Python 3

https://snyk.io/test/github/digitalmensch/contrapy/badge.svg https://travis-ci.org/digitalmensch/contrapy.svg?branch=master https://coveralls.io/repos/github/digitalmensch/contrapy/badge.svg?branch=master https://img.shields.io/pypi/pyversions/contrapy.svg https://img.shields.io/pypi/l/contrapy.svg

Examples

import contrapy

@contrapy.check(lambda a, b, _return: a + b == _return, lambda a, b: a < b)
def demo(a : 22, b : float) -> float:
    return a + b

>>> demo(22, 33.0)
55.0
>>> demo(21, 33.0)
[...]
ValueError: a should be 22

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

contrapy-2018.1.30.tar.gz (2.3 kB view details)

Uploaded Source

File details

Details for the file contrapy-2018.1.30.tar.gz.

File metadata

File hashes

Hashes for contrapy-2018.1.30.tar.gz
Algorithm Hash digest
SHA256 2a5818c8aeeaf1c8f4a927a5dba39a85ebe1c3921adafd426c1c888c4aa586ea
MD5 2a80f6c4b62622b81351a653fce5629d
BLAKE2b-256 f54201dc90f81234494640044a8de03ea5e9d7fd71cbc877c36e7a5a9c511e6b

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