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:
import math
p2 = for_all([arb_int()], lambda n: math.sqrt(n*n) == n)
check(p2)
Falsified after 2 tests (31 shrinks):
> [-1]
Build status
Changes
0.6 (2015-11-23)
add check_and_assert function into papylon.checker module
add Properties class into papylon.prop module
add check_all function into papylon.checker module
modify papylon.gen module to use generator
0.5 (2015-01-16)
implement the shrinking system
add from_gen_shrink function into papylon.arbitrary module
0.4 (2014-12-23)
add such_that method into papylon.gen.Gen class
add constant function into papylon.gen module
support .whl files instead of .egg files in packaging
0.3 (2014-12-13)
modify ArbFloat to use the format of IEEE 754
add ArbDate, arb_date and from_gen into papylon.arbitrary module
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 Distributions
Built Distribution
File details
Details for the file papylon-0.6.1-py3-none-any.whl
.
File metadata
- Download URL: papylon-0.6.1-py3-none-any.whl
- Upload date:
- Size: 18.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | afdc59b2b2001661a72f35998a2fc70e40a82360d6490c7655b6e582c944742b |
|
MD5 | 1c7242b4018d65ed036f9a78bd2324f6 |
|
BLAKE2b-256 | 9255aa57bf1317ccaa73711a938bc10c42a87c760a275688d1f72aa4af252b9c |