def test_generate_consonant_if_output_in_original_list(self): """Test generate_consonant function if the output is in the original list. The result is expected True """ consonants = [ 'b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z' ] self.assertTrue(dungeonsanddragons.generate_consonant() in consonants)
def test_generate_consonant_type(self): """Test generate_consonant function if the type of output is string. The result is expected True """ self.assertTrue(type(dungeonsanddragons.generate_consonant()) == str)
def test_generate_consonant_length(self): """Test generate_consonant function if the length of output is 1. The result is expected 1 """ self.assertEqual(len(dungeonsanddragons.generate_consonant()), 1)
def test_generate_consonant(self): consonant = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'z'] actual_value = generate_consonant() self.assertTrue(actual_value in consonant)
def test_generate_consonant_min(self, mock_randint): actual = generate_consonant() expected = 'b' self.assertEqual(expected, actual)
def test_generate_consonant1(self): self.assertEqual(1, len(dungeonsanddragons.generate_consonant())) # Tests that output has a length of one
def test_generate_consonant(self): self.assertEqual(str, type(dungeonsanddragons.generate_consonant())) # Tests that output is of type string
def test_generate_consonant2(self): random.seed(4) self.assertEqual('K', dungeonsanddragons.generate_consonant()) # Tests fixed random output random.seed()