示例#1
0
def test_mix_with_first_lyrics_with_1_line_and_second_lyrics_with_2_lines(
        lyrics_editor):
    song1 = Song(SongTitle('artist1', 'title1'), Lyrics('lyrics 1 line 2'))
    song2 = Song(SongTitle('artist2', 'title2'),
                 Lyrics('lyrics 2 line 2\nlyrics 2 line 2'))
    mixed_lyrics = lyrics_editor.mix(song1, song2)
    assert mixed_lyrics.lines == ['lyrics 1 line 2', 'lyrics 2 line 2']
示例#2
0
def test_mix_with_same_number_of_lines(lyrics_editor):
    song1 = Song(SongTitle('artist1', 'title1'),
                 Lyrics('lyrics 1 line 2\nlyrics 1 line 2\n\nlyrics 1 line 3'))
    song2 = Song(SongTitle('artist2', 'title2'),
                 Lyrics('lyrics 2 line 2\nlyrics 2 line 2\n\nlyrics 2 line 3'))
    mixed_lyrics = lyrics_editor.mix(song1, song2)
    assert mixed_lyrics.lines == [
        'lyrics 1 line 2', 'lyrics 2 line 2', 'lyrics 1 line 2',
        'lyrics 2 line 2', '', '', 'lyrics 1 line 3', 'lyrics 2 line 3'
    ]
示例#3
0
def test_mix_with_first_paragraph_containing_two_lines_and_second_paragraph_containing_one_line(
        lyrics_editor):
    song1 = Song(SongTitle('artist1', 'title1'),
                 Lyrics('lyrics 1 line 2\n\nlyrics 1 line 2\nlyrics 1 line 3'))
    song2 = Song(SongTitle('artist2', 'title2'),
                 Lyrics('lyrics 2 line 2\n\nlyrics 2 line 2\nlyrics 2 line 3'))
    mixed_lyrics = lyrics_editor.mix(song1, song2)
    assert mixed_lyrics.lines == [
        'lyrics 1 line 2', 'lyrics 2 line 2', '', '', 'lyrics 1 line 2',
        'lyrics 2 line 2', 'lyrics 1 line 3', 'lyrics 2 line 3'
    ]
    assert mixed_lyrics.paragraphs == [
        'lyrics 1 line 2\nlyrics 2 line 2',
        'lyrics 1 line 2\nlyrics 2 line 2\nlyrics 1 line 3\nlyrics 2 line 3'
    ]
 def mix_specific_lyrics(lyrics_mixer: LyricsMixer, artist1, title1,
                         artist2, title2):
     mixed = lyrics_mixer.mix_specific_lyrics(SongTitle(artist1, title1),
                                              SongTitle(artist2, title2))
     return f'{escape(str(mixed))}'
示例#5
0
 def mix_using(self, lyrics_mixer):
     return lyrics_mixer.mix_specific_lyrics(
         SongTitle(self.artist1, self.title1),
         SongTitle(self.artist2, self.title2))
def create_born_to_be_wild():
    return Song(
        SongTitle('Steppenwolf', 'Born to be wild'),
        Lyrics(read_file('songs/tests/steppenwolf_-_born_to_be_wild.txt')))
def create_stairway_to_heaven():
    return Song(
        SongTitle('Led Zeppelin', 'Stairway to Heaven'),
        Lyrics(read_file('songs/tests/led_zeppelin_-_stairway_to_heaven.txt')))
def test_song_equals_by_artist_and_title():
    song1 = Song(SongTitle('Led Zeppelin', 'Stairway to Heaven'),
                 Lyrics('some lyrics'))
    song2 = Song(SongTitle('Led Zeppelin', 'Stairway to Heaven'),
                 Lyrics('other lyrics'))
    assert song1 == song2
示例#9
0
def test_get_song():
    song = Song.entitled(SongTitle('Led Zeppelin', 'Stairway to Heaven'))

    assert song.has_lyrics()