Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error_case test gen to check for 'score' prpty #2840

Merged
merged 2 commits into from
Jan 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions exercises/practice/bowling/.meta/template.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@
rolls = {{ input["previousRolls"] }}
game = self.roll_new_game(rolls)
{% if case is error_case -%}
{% set property = case["property"] -%}
with self.assertRaisesWithMessage(Exception):
{% if property == 'score' -%}
game.score()
{% else -%}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense for this to explicitly check the property value?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IsaacG - The CI for this has not run (as previously asked -- please run the CI and make sure it passes before reviewing. If you cannot run the CI, please do not review.).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do believe I cannot run the CI.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please refrain from reviewing PRs that require a manually triggered CI run then. Thanks.

game.roll({{ input["roll"] }})
{% endif -%}
{% else -%}
self.assertEqual(game.score(), {{ case["expected"] }})
{% endif %}
Expand Down
10 changes: 5 additions & 5 deletions exercises/practice/bowling/bowling_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,13 @@ def test_an_unstarted_game_cannot_be_scored(self):
rolls = []
game = self.roll_new_game(rolls)
with self.assertRaisesWithMessage(Exception):
game.roll()
game.score()

def test_an_incomplete_game_cannot_be_scored(self):
rolls = [0, 0]
game = self.roll_new_game(rolls)
with self.assertRaisesWithMessage(Exception):
game.roll()
game.score()

def test_cannot_roll_if_game_already_has_ten_frames(self):
rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
Expand All @@ -171,23 +171,23 @@ def test_bonus_rolls_for_a_strike_in_the_last_frame_must_be_rolled_before_score_
rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10]
game = self.roll_new_game(rolls)
with self.assertRaisesWithMessage(Exception):
game.roll()
game.score()

def test_both_bonus_rolls_for_a_strike_in_the_last_frame_must_be_rolled_before_score_can_be_calculated(
self,
):
rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10]
game = self.roll_new_game(rolls)
with self.assertRaisesWithMessage(Exception):
game.roll()
game.score()

def test_bonus_roll_for_a_spare_in_the_last_frame_must_be_rolled_before_score_can_be_calculated(
self,
):
rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3]
game = self.roll_new_game(rolls)
with self.assertRaisesWithMessage(Exception):
game.roll()
game.score()

def test_cannot_roll_after_bonus_roll_for_spare(self):
rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3, 2]
Expand Down