Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to see the output of Python's hypothesis library

When using the hypothesis library and performing unit testing, how can I see what instances the library is trying on my code?

Example

from hypothesis import given
import hypothesis.strategies as st

@given(st.integers())
def silly_example(some_number):
    assert some_number > 0

The question is: how do I print / see the some_number variable, generated by the library?

like image 811
Newskooler Avatar asked Oct 30 '18 20:10

Newskooler


1 Answers

See here - either the note function and --hypothesis-verbosity=verbose, or the event function and --hypothesis-show-statistics should do the trick.

like image 147
Zac Hatfield-Dodds Avatar answered Sep 26 '22 06:09

Zac Hatfield-Dodds