コード例 #1
0
    def test_roll_dice_three_di(self, mock_randint):
        mock_randint.return_value = 6

        result = roll_dice(3)
        expected = [6, 6, 6]

        self.assertEqual(result, expected)
コード例 #2
0
    def test_1_roll(self, random_number_generator):
        expected_output = [5]

        num_of_rolls = 1
        actual_value = roll_dice(num_of_rolls)

        self.assertEqual(expected_output, actual_value)
コード例 #3
0
    def test_4_rolls(self, random_number_generator):

        expected_output = [1, 2, 5, 2]

        num_of_rolls = 4
        actual_value = roll_dice(num_of_rolls)

        self.assertEqual(expected_output, actual_value)
コード例 #4
0
    def test_yahtzee_roll_5_rolls(self, random_number_generator):

        expected_output = [1, 1, 1, 1, 1]

        num_of_rolls = 5
        actual_value = roll_dice(num_of_rolls)

        self.assertEqual(expected_output, actual_value)
コード例 #5
0
    def test_full_house_roll_5_rolls(self, random_number_generator):

        expected_output = [3, 2, 3, 2, 3]

        num_of_rolls = 5
        actual_value = roll_dice(num_of_rolls)

        self.assertEqual(expected_output, actual_value)
コード例 #6
0
    def test_consecutive_roll_5_rolls(self, random_number_generator):

        expected_output = [1, 2, 3, 4, 5]

        num_of_rolls = 5
        actual_value = roll_dice(num_of_rolls)

        self.assertEqual(expected_output, actual_value)
コード例 #7
0
 def test_roll_dice_empty(self, mock_random):
     actual_hand = []
     roll_dice(actual_hand)
     expected_hand = [6, 6, 6, 6, 6]
     self.assertEqual(expected_hand, actual_hand, "Initial hand is empty.")
コード例 #8
0
 def test_roll_dice_sixes(self, mock_random):
     actual_hand = [6, 6, 6]
     roll_dice(actual_hand)
     expected_hand = [6, 6, 6, 6, 6]
     self.assertEqual(expected_hand, actual_hand,
                      "Initial hand already has sixes.")
コード例 #9
0
 def test_roll_dice_five(self, mock_random):
     actual_hand = [5, 5, 5, 5, 5]
     roll_dice(actual_hand)
     expected_hand = [5, 5, 5, 5, 5]
     self.assertEqual(expected_hand, actual_hand,
                      "Initial hand already has 5 dice.")
コード例 #10
0
 def test_roll_dice_four(self, mock_random):
     actual_hand = [1, 4, 5, 5]
     roll_dice(actual_hand)
     expected_hand = [1, 4, 5, 5, 6]
     self.assertEqual(expected_hand, actual_hand,
                      "Initial hand has 4 dice.")
コード例 #11
0
 def test_roll_dice_three(self, mock_random):
     actual_hand = [1, 2, 2]
     roll_dice(actual_hand)
     expected_hand = [1, 2, 2, 6, 6]
     self.assertEqual(expected_hand, actual_hand,
                      "Initial hand has 3 dice.")
コード例 #12
0
 def test_roll_dice_one(self, mock_random):
     actual_hand = [1]
     roll_dice(actual_hand)
     expected_hand = [1, 6, 6, 6, 6]
     self.assertEqual(expected_hand, actual_hand,
                      "Initial hand has only 1 die.")