Esempio n. 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))
Esempio n. 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'))
Esempio n. 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))
Esempio n. 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'))
Esempio n. 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'))
Esempio n. 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))
Esempio n. 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))
Esempio n. 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))
Esempio n. 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))
Esempio n. 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))
Esempio n. 11
0
 def test_generate_strike(self, mock_choices, mock_choice):
     mock_choices.return_value = [10]
     self.assertTupleEqual(generate_pair_of_pins(), (10, None))
Esempio n. 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')])
Esempio n. 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)])