def test_get_rhymes_offset(stressed_endings): output = ( ['-', 'a', '-', 'a', '-', 'a', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-'], ['', 'or', '', 'or', '', 'or', '', '', '', '', '', '', '', '', '', ''], [0, -2, 0, -2, 0, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] ) assert get_rhymes(stressed_endings, offset=4) == output
def test_get_rhymes_relaxation(stressed_endings): output = ( ['-', 'a', '-', 'a', '-', 'a', '-', 'a', '-', 'b', '-', '-', '-', 'a', '-', 'b'], ['', 'or', '', 'or', '', 'or', '', 'or', '', 'on', '', '', '', 'or', '', 'on'], [0, -2, 0, -2, 0, -2, 0, -2, 0, -2, 0, 0, 0, -2, 0, -2] ) assert get_rhymes(stressed_endings, relaxation=True) == output
def test_get_rhymes_assonance(stressed_endings): output = ( ['a', 'b', '-', 'b', '-', 'b', 'a', 'b', 'a', '-', 'c', 'b', 'c', 'b', '-', 'b'], ['ao', 'o', '', 'o', '', 'o', 'ao', 'o', 'ao', '', 'ia', 'o', 'ia', 'o', '', 'o'], [-2, -1, 0, -1, 0, -1, -2, -1, -2, 0, -2, -1, -2, -1, 0, -1], ) assert get_rhymes(stressed_endings, assonance=True) == output
def test_get_rhymes_relaxation_offset_unrhymed(stressed_endings): output = ( ['$', 'a', '$', 'a', '$', 'a', '$', '$', '$', '$', '$', '$', '$', '$', '$', '$'], ['', 'or', '', 'or', '', 'or', '', '', '', '', '', '', '', '', '', ''], [0, -2, 0, -2, 0, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] ) assert get_rhymes( stressed_endings, relaxation=True, offset=4, unrhymed_verse_symbol="$" ) == output
def test_get_rhymes_assonance_offset_unrhymed(stressed_endings): output = ( ['$', 'a', '$', 'a', '$', 'a', '$', 'a', 'b', '$', 'c', 'a', 'c', 'a', '$', 'a'], ['', 'o', '', 'o', '', 'o', '', 'o', 'ao', '', 'ia', 'o', 'ia', 'o', '', 'o'], [0, -1, 0, -1, 0, -1, 0, -1, -2, 0, -2, -1, -2, -1, 0, -1] ) assert get_rhymes( stressed_endings, assonance=True, offset=4, unrhymed_verse_symbol="$" ) == output
def test_get_rhymes_unrhymed(stressed_endings): output = ( ['$', 'a', '$', 'a', '$', 'a', '$', 'a', '$', '$', '$', '$', '$', 'a', '$', '$'], ['', 'or', '', 'or', '', 'or', '', 'or', '', '', '', '', '', 'or', '', ''], [0, -2, 0, -2, 0, -2, 0, -2, 0, 0, 0, 0, 0, -2, 0, 0] ) assert get_rhymes( stressed_endings, unrhymed_verse_symbol="$" ) == output
def test_get_rhymes_assonance_offset(stressed_endings): output = ( ['-', 'a', '-', 'a', '-', 'a', '-', 'a', 'b', '-', 'c', 'a', 'c', 'a', '-', 'a'], ['', 'o', '', 'o', '', 'o', '', 'o', 'ao', '', 'ia', 'o', 'ia', 'o', '', 'o'], [0, -1, 0, -1, 0, -1, 0, -1, -2, 0, -2, -1, -2, -1, 0, -1] ) assert get_rhymes( stressed_endings, assonance=True, offset=4 ) == output
def test_get_rhymes_assonance_relaxation_unrhymed(stressed_endings): output = ( ['a', 'b', 'c', 'b', 'c', 'b', 'a', 'b', 'a', 'b', 'd', 'b', 'd', 'b', '$', 'b'], ['ao', 'o', 'aa', 'o', 'aa', 'o', 'ao', 'o', 'ao', 'o', 'ia', 'o', 'ia', 'o', '', 'o'], [-2, -1, -2, -1, -2, -1, -2, -1, -2, -1, -2, -1, -2, -1, 0, -1], ) assert get_rhymes( stressed_endings, assonance=True, relaxation=True, unrhymed_verse_symbol="$" ) == output
def test_get_rhymes_assonance_relaxation_exceded_offset_unrhymed(): stressed_endings = [ (['car', 'cha'], 7, -2), (['po', 'bre'], 5, -2), (['días'], 6, -1), (['no', 'ches'], 5, -2), (['bo', 'lla'], 5, -2), (['car', 'cha'], 6, -2), (['don', 'da'], 5, -2) ] output = ( ['-', 'a', '-', 'a', 'b', '-', 'b'], ['', 'oe', '', 'oe', 'oa', '', 'oa'], [0, -2, 0, -2, -2, 0, -2] ) assert get_rhymes( stressed_endings, assonance=True, relaxation=True, offset=4 ) == output