Example #1
0
 def test_generate_spare_with_foul_first_ball_as_last_pair(
         self, mock_choices, mock_choice):
     mock_choices.return_value = ['F']
     mock_choice.side_effect = [10, 5]
     self.assertTupleEqual(generate_pair_of_pins(True), ('F', 10, 5))
Example #2
0
 def test_generate_strike_with_subsequent_fouls(self, mock_choices,
                                                mock_choice):
     mock_choices.return_value = [10]
     mock_choice.side_effect = ['F', 'F']
     self.assertTupleEqual(generate_pair_of_pins(True), (10, 'F', 'F'))
Example #3
0
 def test_generate_basic_with_foul_first_ball_as_last_pair(
         self, mock_choices, mock_choice):
     mock_choices.return_value = ['F']
     mock_choice.return_value = 4
     self.assertTupleEqual(generate_pair_of_pins(True), ('F', 4))
Example #4
0
 def test_generate_basic_with_foul_second_ball_as_last_pair(
         self, mock_choices, mock_choice):
     mock_choices.return_value = [7]
     mock_choice.return_value = 'F'
     self.assertTupleEqual(generate_pair_of_pins(True), (7, 'F'))
Example #5
0
 def test_generate_basic_with_two_fouls(self, mock_choices, mock_choice):
     mock_choices.return_value = ['F']
     mock_choice.return_value = 'F'
     self.assertTupleEqual(generate_pair_of_pins(), ('F', 'F'))
Example #6
0
 def test_generate_spare_with_foul_first_ball(self, mock_choices,
                                              mock_choice):
     mock_choices.return_value = ['F']
     mock_choice.return_value = 10
     self.assertTupleEqual(generate_pair_of_pins(), ('F', 10))
Example #7
0
 def test_generate_strike_as_last_pair(self, mock_choices, mock_choice):
     mock_choices.return_value = [10]
     mock_choice.side_effect = [4, 6]
     self.assertTupleEqual(generate_pair_of_pins(True), (10, 4, 6))
Example #8
0
 def test_generate_spare_as_last_pair(self, mock_choices, mock_choice):
     mock_choices.return_value = [8]
     mock_choice.side_effect = [2, 3]
     self.assertTupleEqual(generate_pair_of_pins(True), (8, 2, 3))
Example #9
0
 def test_generate_basic_as_last_pair(self, mock_choices, mock_choice):
     mock_choices.return_value = [5]
     mock_choice.return_value = 4
     self.assertTupleEqual(generate_pair_of_pins(True), (5, 4))
Example #10
0
 def test_generate_spare(self, mock_choices, mock_choice):
     mock_choices.return_value = [8]
     mock_choice.return_value = 2
     self.assertTupleEqual(generate_pair_of_pins(), (8, 2))
Example #11
0
 def test_generate_strike(self, mock_choices, mock_choice):
     mock_choices.return_value = [10]
     self.assertTupleEqual(generate_pair_of_pins(), (10, None))
Example #12
0
 def test_generate_pair_of_pins_complete_with_last_pair(self):
     pairs = [generate_pair_of_pins(True) for _ in range(6)]
     self.assertListEqual(pairs, [(10, 6, 0), (5, 4), (7, 1), (6, 'F'),
                                  (3, 7, 9), (10, 8, 'F')])
Example #13
0
 def test_generate_pair_of_pins_complete_no_last_pair(self):
     pairs = [generate_pair_of_pins() for _ in range(6)]
     self.assertListEqual(pairs, [(10, None), (10, None), (7, 'F'), (8, 1),
                                  (6, 'F'), (3, 7)])