Beispiel #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']
Beispiel #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'
    ]
Beispiel #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'
    ]
Beispiel #4
0
def test_lyrics_text():
    assert Lyrics(two_paragraphs_text).text == two_paragraphs_text
Beispiel #5
0
def test_get_paragraphs_from_lyrics():
    assert Lyrics(two_paragraphs_text).paragraphs() == [
        'First paragraph', 'Second paragraph'
    ]
Beispiel #6
0
def test_lyrics_to_string():
    assert str(Lyrics(two_paragraphs_text)) == two_paragraphs_text
Beispiel #7
0
def test_get_lines_from_lyrics():
    lyrics = Lyrics('First line\nSecond line\n\nThird line')
    assert lyrics.lines() == ['First line', 'Second line', '', 'Third line']
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
def test_none_song():
    none_song = Song.none()
    assert none_song.title.is_empty()
    assert none_song.lyrics == Lyrics.empty()