Beispiel #1
0
 def build_two_consecutive_frames(self,
                                  first_roll=0,
                                  second_roll=0,
                                  third_roll=0,
                                  fourth_roll=0):
     frame_1 = self.build_frame(first_roll, second_roll)
     frame_2 = self.build_frame(third_roll, fourth_roll)
     match = BowlingMatch()
     match.add_frame(frame_1)
     match.add_frame(frame_2)
     return match
Beispiel #2
0
 def test_empty_game(self):
     rolls_list = [[]]
     match = BowlingMatch.create_game(rolls_list)
     self.assertEqual(
         match.score(),
         0,
         msg="A game with no rolls in it returns a valid game score")
Beispiel #3
0
 def test_perfect_game(self):
     perfect_roll = [[10]]
     rolls_list = perfect_roll * 11
     match = BowlingMatch.create_game(rolls_list)
     self.assertEqual(
         match.score(),
         300,
         msg="A perfect game of only strikes returns a valid game score")
Beispiel #4
0
 def test_game_spares(self):
     perfect_roll = [[0, 10]]
     rolls_list = perfect_roll * 5
     match = BowlingMatch.create_game(rolls_list)
     self.assertEqual(
         match.score(),
         50,
         msg="A game with 5 spares so far returns a valid game score")
Beispiel #5
0
 def test_game_frame_score(self):
     rolls_list = self.build_rolls_list()
     match = BowlingMatch.create_game(rolls_list)
     self.assertEqual(
         match.frames[0].frame_score(),
         4,
         msg="A game created with a list of rolls returns a valid first "
         "frame score")
Beispiel #6
0
 def test_game_score(self):
     rolls_list = self.build_rolls_list()
     match = BowlingMatch.create_game(rolls_list)
     self.assertEqual(
         match.score(),
         21,
         msg="A game created with a list of rolls returns a valid "
         "game score")