Skip to content

Instantly share code, notes, and snippets.

@sonesuke
Created August 5, 2012 02:51
Show Gist options
  • Save sonesuke/3261256 to your computer and use it in GitHub Desktop.
Save sonesuke/3261256 to your computer and use it in GitHub Desktop.
pytest parametrize
@pytest.mark.parametrize(
('rolls', 'expected'),
[
([1, 2], 18 + 3),
([10, 5, 5], 18 + 30),
([5, 5, 10], 18 + 30),
]
)
def test_10_frame(rolls, expected):
g = Game()
for i in range(0, 18):
g.roll(1)
for r in rolls:
g.roll(r)
assert g.score == expected
with pytest.raises(ValueError):
g.roll(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment