https://github.com/computemachines/quickconstraint
QuickCheck style property testing and run-time constraint checking for python.
https://github.com/computemachines/quickconstraint
Last synced: 8 months ago
JSON representation
QuickCheck style property testing and run-time constraint checking for python.
- Host: GitHub
- URL: https://github.com/computemachines/quickconstraint
- Owner: computemachines
- Created: 2017-02-22T15:09:30.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-02T04:43:03.000Z (over 9 years ago)
- Last Synced: 2025-01-19T21:51:09.150Z (over 1 year ago)
- Language: Python
- Size: 1000 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
README
Clean property based testing for python
========================================
Example usage: sqrt.py::
from quickconstraint import constrain
@constrain
def sqrt(x2: lambda x: 0 <= x):
x = 1
while not approx(x*x - x2):
x = (x + x2/x)/2.0
return x
test-sqrt.py::
from quickconstraint import theorem, test_all_theorems
@theorem
def theorem_sqrt_sq_inverse(n): return sq(sqrt(n)) == n
if __name__=="__main__":
test_all_theorems()