def test_throw_error_if_track_exists(self): """ Should throw DuplicateTrackError given track for disc already exists """ album = GMusicAlbum(id, title, album_artist) album.add_track(1, 3, track) self.assertRaises(DuplicateTrackError, album.add_track, 1, 3, track)
def test_add_track_to_album_on_another_disc(self): """ Should add track to album given same trackNum on different disc """ album = GMusicAlbum(id, title, album_artist) album.add_track(1, 3, track) album.add_track(2, 3, track2) self.assertEqual(len(album.tracks[2]), 1) self.assertEqual(album.tracks.get(2).get(3).title, 'Zhao Hua')
def test_add_track_to_album(self): """ Should add track to album """ album = GMusicAlbum(id, title, album_artist) album.add_track(1, 3, track) self.assertEqual(len(album.tracks), 1) self.assertEqual(len(album.tracks[1]), 1) self.assertEqual(album.tracks.get(1).get(3).title, 'Limerence')
def test_album_total_tracks_count_one_disc(self): """ Given tracks have been added to tracks across 1 disc Should return the correct number of tracks added """ album = GMusicAlbum(id, title, album_artist) album.add_track(1, 3, track) album.add_track(1, 2, track) expected = 2 actual = album.total_tracks() self.assertEqual(actual, expected)
def test_discs_added(self): """ Given tracks have been added to tracks across 2 discs Should return the correct number of discs """ album = GMusicAlbum(id, title, album_artist) album.add_track(1, 3, track) album.add_track(1, 2, track) album.add_track(2, 1, track) expected = set([1, 2]) actual = album.discs_added() self.assertEqual(actual, expected)