def test_roll_die_value_error_with_zero_range(self):
        """Test roll_die function if it raises ValueError if the range is (0, 0).

        The result is expected to raise ValueError
        """
        with self.assertRaises(ValueError):
            dungeonsanddragons.roll_die(1, 0)
    def test_roll_die_with_positive_integer(self):
        """Test roll_die function with positive integers.

        Check if the sum is greater than or equal to (first argument * 1),
        less than or equal to (first argument * second argument)
        The result is expected True
        """
        self.assertTrue(3 <= dungeonsanddragons.roll_die(3, 6) <= 18)
 def test_roll_die6(self):
     random.seed(2)
     self.assertEqual(4, dungeonsanddragons.roll_die(
         3, 6))  # Tests output by holding randomization in place
     random.seed()
 def test_roll_die5(self):
     self.assertEqual(int, type(dungeonsanddragons.roll_die(
         3, 7)))  # Tests that output is of type int
 def test_roll_die4(self):
     self.assertEqual(0, dungeonsanddragons.roll_die(
         0, 0))  # Tests that 0 rolls and 0 sides returns 0
 def test_roll_die_zero_sides(self, mock_randint):
     actual = roll_die(3, 0)
     expected = 0
     self.assertEqual(expected, actual)
    def test_roll_die_with_negative_integer_and_zero(self):
        """Test roll_die function with negative integer and zero.

        The result is expected 0
        """
        self.assertEqual(dungeonsanddragons.roll_die(-1, 0), 0)
    def test_roll_die_with_both_zero(self):
        """Test roll_die function with zeros.

        The result is expected 0
        """
        self.assertEqual(dungeonsanddragons.roll_die(0, 0), 0)
Exemple #9
0
 def test_roll_die_zero_rolls(self, mock_output):
     expected_value = 0
     actual_value = roll_die(0, 22)
     self.assertEqual(actual_value, expected_value)
Exemple #10
0
 def test_roll_die_middle_two(self, mock_output):
     expected_value = 15
     actual_value = roll_die(3, 12)
     self.assertEqual(actual_value, expected_value)
Exemple #11
0
 def test_roll_die_lower(self, mock_output):
     expected_value = 1
     actual_value = roll_die(1, 1)
     self.assertEqual(actual_value, expected_value)
Exemple #12
0
 def test_roll_die_upper(self, mock_output):
     expected_value = 2304
     actual_value = roll_die(192, 17)
     self.assertEqual(actual_value, expected_value)
 def test_roll_die_negative_rolls(self, mock_randint):
     actual = roll_die(-1, 6)
     expected = 0
     self.assertEqual(expected, actual)
 def test_roll_die_positive_rolls_positive_sides(self, mock_randint):
     actual = roll_die(3, 6)
     expected = 3
     self.assertEqual(expected, actual)
 def test_roll_die_one_roll_one_side(self, mock_randint):
     actual = roll_die(1, 1)
     expected = 1
     self.assertEqual(expected, actual)
 def test_roll_die7(self):
     with self.assertRaises(
             TypeError):  # Tests that arguments passed must not be strings
         dungeonsanddragons.roll_die('', 6)
 def test_roll_die(self):
     self.assertLess(0, dungeonsanddragons.roll_die(
         3, 6))  # Tests that output is a positive int
Exemple #18
0
 def test_roll_die_zero_sided_die(self, mock_output):
     expected_value = 0
     actual_value = roll_die(25, 0)
     self.assertEqual(actual_value, expected_value)
Exemple #19
0
 def test_roll_die_middle(self, mock_output):
     expected_value = 8
     actual_value = roll_die(4, 6)
     self.assertEqual(actual_value, expected_value)
 def test_roll_die2(self):
     self.assertGreaterEqual(18, dungeonsanddragons.roll_die(
         3, 6))  # Tests that output is <= num_rolls * num_sides
    def test_roll_die_with_zero_and_negative_integer(self):
        """Test roll_die function with zero and negative integer.

        The result is expected 0
        """
        self.assertEqual(dungeonsanddragons.roll_die(0, -1), 0)
 def test_roll_die3(self):
     self.assertLessEqual(3, dungeonsanddragons.roll_die(
         3, 6))  # Tests that output is >= number of rolls
    def test_roll_die_return_type(self):
        """Test roll_die function if it returns int type properly.

        The result is expected True
        """
        self.assertTrue(type(dungeonsanddragons.roll_die(1, 1)) == int)
 def test_roll_die_negative_sides(self, mock_randint):
     actual = roll_die(3, -1)
     expected = 0
     self.assertEqual(expected, actual)