Skip to main content

Random testing for Python

Project description

Papylon

Papylon is a Python library for random testing of program properties.

Example

We can write a simple property with Python code:

from papylon.prop import for_all
from papylon.arbitrary import arb_list, arb_int
from papylon.checker import check

# reversed and reversed list is the same of the original list
p1 = for_all([arb_list(arb_int(), max_length=20)], lambda x: list(reversed(list(reversed(x)))) == x)
check(p1)

When we run the script above, we can see the result as following:

OK, passed 100 tests.

If a property failed, Papylon reports which arbitrary(s) made it failed:

from papylon.arbitrary import arb_float

p2 = for_all([arb_float(), arb_float()], lambda x, y: x - y == y - x)
check(p2)
Falsified after 1 tests.
> [950620953.3142085, 4571184.136292458]

Build status

https://travis-ci.org/Gab-km/papylon.svg

Changes

0.2 (2014-11-30)

  • add one_of, choose, frequency and map functions into papylon.gen module

  • add ArbStr and arb_str into papylon.arbitrary module

0.1 (2014-11-25)

  • first release

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

papylon-0.2.1.zip (8.1 kB view hashes)

Uploaded Source

Built Distributions

papylon-0.2.1.win32.zip (13.7 kB view hashes)

Uploaded Source

papylon-0.2.1-py3.4.egg (11.6 kB view hashes)

Uploaded Source

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