Created
October 7, 2015 11:54
An example of how Hypothesis can generate test cases
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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