Skip to content

Gab-km/papylon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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]

About

Random testing for Python

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages