コード例 #1
0
 def test_more_songs_album(self):
     album = Album('album title', 2020)
     first_song = Song('first song title')
     second_song = Song('first song title')
     album.add(first_song)
     album.add(second_song)
     assert list(album.songs()) == [first_song, second_song]
コード例 #2
0
 def test_equality_for_different_albums_with_songs(self):
     first_album = Album('album title', 2020)
     second_album = Album('album title', 2020)
     third_album = Album('album title', 2020)
     first_album.add(Song('same song'))
     second_album.add(Song('other song'))
     third_album.add(Song('same song'))
     third_album.add(Song('other song'))
     assert first_album != second_album
     assert first_album != third_album
コード例 #3
0
 def test_to_and_from_str_with_albums(self):
     artist = Artist('artist name', 'country')
     first_album = Album('first album title', 2020)
     first_album.add(Song('first song title'))
     first_album.add(Song('second song title'))
     second_album = Album('second album title', 2021)
     second_album.add(Song('third song title'))
     assert Artist.from_string(str(artist)) == artist
コード例 #4
0
 def test_artists_with_multiple_songs(self):
     artist = Artist('artist name', 'country')
     first_album = Album('first album title', 2020)
     first_album.add(Song('first song title'))
     first_album.add(Song('second song title'))
     second_album = Album('second album title', 2020)
     second_album.add(Song('third song title'))
     artist.add_album(first_album)
     artist.add_album(second_album)
     expected_songs = [
         Song('first song title'),
         Song('second song title'),
         Song('third song title')
     ]
     assert list(artist.get_songs()) == expected_songs
コード例 #5
0
 def test_to_and_from_str_single_track(self):
     album = Album('album title', 2020)
     album.add(Song('song title'))
     assert Album.from_string(str(album)) == album
コード例 #6
0
 def test_equality_for_same_albums_with_songs(self):
     first_album = Album('album title', 2020)
     second_album = Album('album title', 2020)
     first_album.add(Song('same song'))
     second_album.add(Song('same song'))
     assert first_album == second_album
コード例 #7
0
 def test_one_song_album(self):
     album = Album('album title', 2020)
     song = Song('song title')
     album.add(song)
     assert list(album.songs()) == [song]
コード例 #8
0
 def test_artist_with_one_song(self):
     artist = Artist('artist name', 'country')
     album = Album('album title', 2020)
     album.add(Song('song title'))
     artist.add_album(album)
     assert list(artist.get_songs()) == [Song('song title')]
コード例 #9
0
 def test_to_and_from_str_multiple_tracks(self):
     album = Album('album title', 2020)
     album.add(Song('first song title'))
     album.add(Song('second song title'))
     de = Album.from_string(str(album))
     assert Album.from_string(str(album)) == album