Skip to content

Commit 3d572f8

Browse files
authored
Merge pull request #5 from andresaco/feature/write-tests
Feature/write tests
2 parents 8fb6b07 + 8bf4a45 commit 3d572f8

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

Makefile

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
test:
2+
pytest tests --hypothesis-show-statistics

tests/test_app.py

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import pytest
22
import sys
33
from hypothesis import given
4-
from hypothesis.strategies import text, integers, lists, tuples
4+
from hypothesis.strategies import text, integers, lists, tuples, builds
55
from app import Developer, Kitchen
66

77
@given(text(), integers(-sys.maxsize -1, -1))
@@ -38,14 +38,13 @@ def test_team_needs():
3838
for d in team:
3939
assert d[0].maxibon_requests() == d[1]
4040

41-
@given(lists(tuples(text(), integers(0, 10))))
42-
def test_always_min_maxibons(l):
41+
@given(builds(Developer, text(), integers(0, 10)))
42+
def test_always_min_maxibons(developer):
4343
# Given
4444
k = Kitchen()
4545

46-
for t in l:
47-
developer = Developer(t[0], t[1])
48-
# When
49-
remaining = developer.pick_maxibon(k)
50-
# Then
51-
assert remaining > 2
46+
# When
47+
remaining = developer.pick_maxibon(k)
48+
49+
# Then
50+
assert remaining > 2

0 commit comments

Comments
 (0)