Skip to content

Instantly share code, notes, and snippets.

@nottrobin
Created October 7, 2015 11:54
Show Gist options
  • Select an option

  • Save nottrobin/1e665048e4ff698c3da2 to your computer and use it in GitHub Desktop.

Select an option

Save nottrobin/1e665048e4ff698c3da2 to your computer and use it in GitHub Desktop.
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