def test_generate_syllable_elements(self): """Test generate_syllable if it is composed in the correct order of a consonant and a vowel. The result is expected True """ a_syllable = dungeonsanddragons.generate_syllable() self.assertTrue(a_syllable[0] in self.consonants and a_syllable[1] in self.vowels)
def test_generate_syllable_length(self): """Test generate_syllable function if the length of output is 2. The result is expected 2 """ self.assertEqual(len(dungeonsanddragons.generate_syllable()), 2)
def test_generate_syllable_type(self): """Test generate_syllable function if the type of output is str. The result is expected True """ self.assertTrue(type(dungeonsanddragons.generate_syllable()) == str)
def test_generate_syllable2(self): random.seed(5) self.assertEqual('YI', dungeonsanddragons.generate_syllable() ) # Tests fixed random output random.seed()
def test_generate_syllable(self): self.assertEqual(str, type(dungeonsanddragons.generate_syllable()) ) # Tests that output is of type string
def test_generate_syllable1(self): self.assertEqual(2, len(dungeonsanddragons.generate_syllable()) ) # Tests that the length of output is 2
def test_generate_syllable_length(self): expected_value = 2 actual_value = len(generate_syllable()) self.assertEqual(actual_value, expected_value)
def test_generate_syllable_vowel(self): vowel = ['a', 'e', 'i', 'o', 'u', 'y'] actual_value = generate_syllable() self.assertTrue(actual_value[1] in vowel)
def test_generate_syllable_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_syllable() self.assertTrue(actual_value[0] in consonant)
def test_generate_syllable_min_consonant_and_vowel(self, mock_randint): actual = generate_syllable() expected = 'ba' self.assertEqual(expected, actual)