Skip to content

Instantly share code, notes, and snippets.

@nottrobin
Created October 7, 2015 11:54
An example of how Hypothesis can generate test cases
from hypothesis.strategies import lists, floats
@given(lists(floats()))
def test_average(float_list):
ave = reduce(lambda x, y: x + y, float_list) / len(float_list)
assert average(float_list) == ave
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment