Skip to content

Instantly share code, notes, and snippets.

@thilp
Created February 5, 2019 22:02
Show Gist options
  • Save thilp/172bc39806c2f35530770b12703b1173 to your computer and use it in GitHub Desktop.
Save thilp/172bc39806c2f35530770b12703b1173 to your computer and use it in GitHub Desktop.
from hypothesis import given
from hypothesis.strategies import booleans, lists, integers
def foo():
... # FIXME
def test_foo_1_2_3():
assert foo(1, 2, 3) == 6
def test_foo_list_of_many():
numbers = list(range(99))
assert foo(*numbers) == sum(range(99))
def bar():
... # FIXME
def test_bar_list_of_3():
numbers = list(range(99))
assert bar(numbers) == sum(range(99))
def baz() -> dict:
return {
"first": ...,
"next": [...],
"depth": ...,
# FIXME
}
@given(booleans(), lists(booleans()), integers(), integers())
def test_baz_mixed(first, next, depth, v):
assert baz(first, *next, depth=depth, k=v) == {
"first": first,
"next": next,
"depth": depth,
"k": v,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment