QuickCheck-like testing framework for Python
pyqcy [pyksi:] is a test framework that supports unique testing model, inspired by the brilliant QuickCheck library for Haskell. Rather than writing fully-fledged test cases, you only need to define logical properties that your code has to satisfy. Based on that, pyqcy will automatically generate test cases - hundreds of them, in fact!
from pyqcy import qc, int_, main @qc def addition_actually_works( x=int_(min=0), y=int_(min=0) ): the_sum = x + y assert the_sum >= x and the_sum >= y if __name__ == '__main__': main()
$ python ./example.py addition_actually_works: passed 100 tests.
Yes, that's 100 distinct test cases. pyqcy has generated them all for you!
Either from PyPI:
$ pip install pyqcy
or directly from GitHub if you want the bleeding edge version:
$ git clone git://github.com/Xion/pyqcy.git $ cd pyqcy $ ./setup.py develop
Check out documentation for detailed usage instructions and more information.
Although already usable, pyqcy is still in development phase. The aim is to have it mimic the Haskell's QuickCheck very closely while remaining pythonic and taking advantage of dynamic nature of the language.
Thoughts, opinions, ideas and contributions are all very welcome! Head over to GitHub for more info.