def test_last_phonemes_more_than_one_vowel_phonemes(self):
        """ Test last_phonemes on a list contains more than one vowel \
            phonemes, but not all."""

        actual = poetry_functions.last_phonemes(['C', 'H1', 'A', 'N0', 'Y'])
        expected = ['N0', 'Y']
        self.assertEqual(actual, expected, 'more than one vowel phonemes')
Esempio n. 2
0
    def test_single_line(self):

        phoneme_list = ['N', 'EH1', 'N', 'D', 'Z']

        actual = poetry_functions.last_phonemes(phoneme_list)
        expected = ['EH1', 'N', 'D', 'Z']
        self.assertEqual(actual, expected)
    def test_last_phonemes_only_last_vowel_phoneme(self):
        """ Test last_phonemes on a list contains only one vowel phoneme \
            at index -1. """

        actual = poetry_functions.last_phonemes(['H', 'B', 'D1'])
        expected = ['D1']
        self.assertEqual(actual, expected, 'only last vowel phoneme')
    def test_last_phonemes_only_middle_vowel_phoneme(self):
        """ Test last_phonemes on a list contains only one vowel phoneme \
            not at index 0 or index -1. """

        actual = poetry_functions.last_phonemes(['H', 'B1', 'D'])
        expected = ['B1', 'D']
        self.assertEqual(actual, expected, 'only middle vowel phoneme')
Esempio n. 5
0
    def test_single_line(self):

        phoneme_list = [ 'N','EH1', 'N', 'D', 'Z']


        actual = poetry_functions.last_phonemes(phoneme_list)
        expected = ['EH1', 'N', 'D', 'Z']
        self.assertEqual(actual, expected)
Esempio n. 6
0
    def test_multiple_words(self):

        phoneme_list = [
            'DH', 'AH0', 'F', 'ER1', 'S', 'T', 'L', 'AY1', 'N', 'L', 'IY1',
            'D', 'Z', 'AO1', 'F', 'W', 'IH1', 'DH', 'AH0', 'G', 'AE1', 'P',
            'B', 'IH0', 'F', 'AO1', 'R', 'N', 'EH1', 'K', 'S', 'T'
        ]

        actual = poetry_functions.last_phonemes(phoneme_list)
        expected = ['EH1', 'K', 'S', 'T']
        self.assertEqual(actual, expected)
Esempio n. 7
0
    def test_consecutive_vowels_phonemes(self):

        phoneme_list = [
            'DH', 'AH0', 'F', 'ER1', 'S', 'T', 'L', 'AY1', 'N', 'L', 'IY1',
            'D', 'Z', 'AO1', 'F', 'W', 'IH1', 'DH', 'AH0', 'G', 'AE1', 'P',
            'B', 'IH0', 'F', 'AO1', 'R', 'N', 'EH1', 'K', 'S', 'T', 'DH',
            'EH1', 'N', 'P', 'OW1', 'AH0', 'M'
        ]

        actual = poetry_functions.last_phonemes(phoneme_list)
        expected = ['AH0', 'M']
        self.assertEqual(actual, expected)
Esempio n. 8
0
    def test_multiple_words(self):

        phoneme_list = ['DH', 'AH0',
                        'F', 'ER1', 'S', 'T',
                        'L', 'AY1', 'N',
                        'L', 'IY1', 'D', 'Z',
                        'AO1', 'F',
                        'W', 'IH1', 'DH',
                        'AH0',
                        'G', 'AE1', 'P',
                        'B', 'IH0', 'F', 'AO1', 'R',
                        'N', 'EH1', 'K', 'S', 'T']

        actual = poetry_functions.last_phonemes(phoneme_list)
        expected = ['EH1', 'K', 'S', 'T']
        self.assertEqual(actual, expected)
Esempio n. 9
0
    def test_consecutive_vowels_phonemes(self):

        phoneme_list = ['DH', 'AH0',
                        'F', 'ER1', 'S', 'T',
                        'L', 'AY1', 'N',
                        'L', 'IY1', 'D', 'Z',
                        'AO1', 'F',
                        'W', 'IH1', 'DH',
                        'AH0',
                        'G', 'AE1', 'P',
                        'B', 'IH0', 'F', 'AO1', 'R',
                        'N', 'EH1', 'K', 'S', 'T',
                        'DH', 'EH1', 'N',
                        'P', 'OW1', 'AH0', 'M']

        actual = poetry_functions.last_phonemes(phoneme_list)
        expected = ['AH0', 'M']
        self.assertEqual(actual, expected)
Esempio n. 10
0
    def test_last_phonemes_empty(self):
        """ Test last_phonemes on an empty list. """

        actual = poetry_functions.last_phonemes([])
        expected = []
        self.assertEqual(actual, expected, 'empty list')
Esempio n. 11
0
assert isinstance(result, list), \
    '''poetry_functions.get_poem_lines should return a list,''' \
    ''' but returned {0}.'''.format(type(result))
for item in result:
    assert isinstance(item, str), \
        '''poetry_functions.get_poem_lines should return a list of str,''' \
        ''' but returned a list of {0}.'''.format(type(item))

# Type check poetry_functions.count_vowel_phonemes
result = poetry_functions.count_vowel_phonemes([['P', 'OW1', 'AH0', 'M']])
assert isinstance(result, int), \
    '''poetry_functions.count_vowel_phonemes should return an int,''' \
    ''' but returned {0}.'''.format(type(result))

# Type check poetry_functions.last_phonemes
result = poetry_functions.last_phonemes(['G', 'AE1', 'P'])
assert isinstance(result, list), \
    '''poetry_functions.last_phonemes should return a list,''' \
    ''' but returned {0}.'''.format(type(result))
for item in result:
    assert isinstance(item, str), \
        '''poetry_functions.last_phonemes should return a list of str,''' \
        ''' but returned a list of {0}.'''.format(type(item))

# Set-up for the below type checks.
poem_lines = [
    'The first line leads off,', 'With a gap before the next.',
    'Then the poem ends.'
]
pattern = ([5, 7, 5], ['A', 'B', 'A'])
word_to_phonemes = {
Esempio n. 12
0
    def test_last_phonemes_empty(self):
        """ Test last_phonemes on an empty list. """

        actual = poetry_functions.last_phonemes([])
        expected = []
        self.assertEqual(actual, expected, 'empty list')
    def test_last_phonemes_no_vowel_phoneme(self):
        """ Test last_phonemes on a list without any vowel phonemes. """

        actual = poetry_functions.last_phonemes(['H', 'B', 'D'])
        expected = []
        self.assertEqual(actual, expected, 'no vowel phoneme')
    def test_last_phonemes_all_vowel_phonemes(self):
        """ Test last_phonemes on a list only contains vowel phonemes. """

        actual = poetry_functions.last_phonemes(['H1', 'CO2', 'TT0'])
        expected = ['TT0']
        self.assertEqual(actual, expected, 'all vowel phonemes')