Skip to main content

Easy-to-use, extensible random testing library.

Project description


pyquchk (abbreviated from Python QuickCheck) is and easy-to-use, extensible random testing library. As you see from the name, it’s inspired by Haskell QuickCheck, but the aim is not only to implement all the useful features from it, but actually provide more capabilities.


Some examples to get the overall idea how to use it for testing:

def int_associativity(a=int, b=int, c=int):
    # this is correct
    assert a + (b + c) == (a + b) + c

def float_associativity(a=float, b=float, c=float):
    # this is wrong
    assert a + (b + c) == (a + b) + c

def float_list_sum(a=list_(length=int_(1, 20), elements=float_())):
    # this is wrong
    assert sum(a) == sum(reversed(a))

def float_list_sum(a=list_):
    # this is wrong, althrough the list consists of int only!
    assert sum(a) == sum(reversed(a))

You can put this in a file, add from pyquchk import * and run nosetests on this file (other test runners were not tested). Then you see, that the first test passed, and other two didn’t. Futhermore, pyquchk will show you values for which they don’t hold, and try to shrink them (not optimal yet).

The last test case fails fast as a feature which I call ‘edgecases generation’ is implemented here: a small number of edge cases defined in a generator are always tested first, and for lists they include an empty list (plus some other values).

Further info

Also, you can quite easy add new arbitrary values generators and combine them, but I haven’t written a documentation about how to do this.

Complete documentation and more pre-defined generators coming soon!

Please write to if you have any related suggestions.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pyquchk, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size pyquchk-0.1.2-py2.7.egg (18.4 kB) File type Egg Python version 2.7 Upload date Hashes View
Filename, size pyquchk-0.1.2-py3.3.egg (19.9 kB) File type Egg Python version 3.3 Upload date Hashes View
Filename, size pyquchk-0.1.2.tar.gz (6.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page