QuickCheck-like testing framework for Python
Project description
pyqcy
=====
*pyqcy* [pyksi:] is an automated testing framework for Python
inspired by the wonderful *QuickCheck* library for Haskell.
What's the idea?
----------------
Instead of writing fully-fledged test cases, with *pyqcy*
you simply define logical **properties** that your code
is expected to satisfy. Based on that, *pyqcy* will
automatically generate test cases for you - hundreds of them,
in fact!
How does it look like?
----------------------
For starters, try this:
::
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()
::
$ pip install pyqcy
$ python test.py
addition_actually_works: passed 100 tests.
*pyqcy* generated 100 test cases and checked whether
they all pass. For a few lines of code, that's rather nice,
isn't it? :)
Of course, you are not limited to integers - there is
built-in support for all standard types, including lists
and dictionaries. Custom classes can be used as well:
just specify how to generate an *@arbitrary* object
of your class, and you're set.
Hey, I like it!
---------------
Then check these links to find out more:
* `website <http://xion.github.com/pyqcy>`_
* `github <http://github.com/Xion/pyqcy>`_
* `development version
<http://github.com/Xion/pyqcy/zipball/master#egg=pyqcy>`_
=====
*pyqcy* [pyksi:] is an automated testing framework for Python
inspired by the wonderful *QuickCheck* library for Haskell.
What's the idea?
----------------
Instead of writing fully-fledged test cases, with *pyqcy*
you simply define logical **properties** that your code
is expected to satisfy. Based on that, *pyqcy* will
automatically generate test cases for you - hundreds of them,
in fact!
How does it look like?
----------------------
For starters, try this:
::
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()
::
$ pip install pyqcy
$ python test.py
addition_actually_works: passed 100 tests.
*pyqcy* generated 100 test cases and checked whether
they all pass. For a few lines of code, that's rather nice,
isn't it? :)
Of course, you are not limited to integers - there is
built-in support for all standard types, including lists
and dictionaries. Custom classes can be used as well:
just specify how to generate an *@arbitrary* object
of your class, and you're set.
Hey, I like it!
---------------
Then check these links to find out more:
* `website <http://xion.github.com/pyqcy>`_
* `github <http://github.com/Xion/pyqcy>`_
* `development version
<http://github.com/Xion/pyqcy/zipball/master#egg=pyqcy>`_
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyqcy-0.2.2.tar.gz
(11.3 kB
view details)
File details
Details for the file pyqcy-0.2.2.tar.gz.
File metadata
- Download URL: pyqcy-0.2.2.tar.gz
- Upload date:
- Size: 11.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e22cc5e2c01b0507c76650900ff9919cc0f9b78f6cad4eea728b50f667d60be8
|
|
| MD5 |
f9164990b9cd3205c58647b44bc61ced
|
|
| BLAKE2b-256 |
4dde99270ed525b47d94c334aabd3cbbb06ec3ad4c2ec518a5936139bd4487ca
|