Exemplo n.º 1
0
 def test_lines_in_couplet_do_not_end_with_same_word(self):
     MC = MCMarkov(self.where_the_sidewalk_ends, 1, True)
     song = MC.create_song(4, 10)
     for couplet in song:
         endword1 = couplet[0][-1]
         endword2 = couplet[1][-1]
         self.assertNotEqual(endword1, endword2)
Exemplo n.º 2
0
 def test_rhymes_within_couplet(self):
     MC = MCMarkov(self.where_the_sidewalk_ends, 1, True)
     song = MC.create_song(4, 10)
     for couplet in song:
         endword1 = couplet[0][-1]
         endword2 = couplet[1][-1]
         self.assertTrue(rhymes_with(endword1, endword2))
Exemplo n.º 3
0
 def test_syllable_map(self):
     MC = MCMarkov(self.where_the_sidewalk_ends, 1, True)
     syllable_map = [[7,10],[5,12]]
     new_song = MC.create_song(couplet_count=None, syllable_count=None, syllable_map=syllable_map)
     for i, couplet in enumerate(new_song):
         couplet_map = syllable_map[i]
         for j, line in enumerate(couplet):
             line_map = couplet_map[j]
             sylcount = sum(nsyl(word) for word in line)
             self.assertEqual(sylcount, line_map)
Exemplo n.º 4
0
 def test_lines_in_couplet_have_syllable_length(self):
     MC = MCMarkov(self.where_the_sidewalk_ends, 1, True)
     song = MC.create_song(4, 10)
     for couplet in song:
         for line in couplet:
             self.assertEqual(sum(nsyl(word) for word in line),10)
Exemplo n.º 5
0
 def test_couplets_are_not_empty(self):
     MC = MCMarkov(self.where_the_sidewalk_ends, 1, True)
     song = MC.create_song(4, 10)
     for couplet in song:
         for line in couplet:
             self.assertGreater(len(line),0)
Exemplo n.º 6
0
 def test_song_contains_correct_number_of_couplets(self):
     MC = MCMarkov(self.where_the_sidewalk_ends, 1, True)
     song = MC.create_song(4, 10)
     self.assertEqual(len(song),4)