Created
August 5, 2012 02:51
-
-
Save sonesuke/3261256 to your computer and use it in GitHub Desktop.
pytest parametrize
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
@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