def test_add_song(self): song_list = SongList(self.empty_db) song = Song(artist='Artist', title='Title', album='Album') self.assertEqual(len(song_list), 0) self.assertFalse(song in song_list) song_list.add_song(song) self.assertEqual(len(song_list), 1) self.assertTrue(song in song_list) self.assertTrue( Song(artist='Artist', title='Title', album='Album') in song_list) with self.assertRaises(ValueError): song_list.add_song(song)
def test_add_song_from_filename(self): song_list = SongList(self.empty_db) file_path = os.path.join(self.mp3_files, 'Kinematic - Peyote.mp3') song = Song.from_filename(file_path, music_dir=self.mp3_files) self.assertEqual(len(song_list), 0) self.assertFalse(song in song_list) song_list.add_song(song) self.assertEqual(len(song_list), 1) self.assertTrue(song in song_list) self.assertTrue( Song(artist='Kinematic', title='Peyote', album='Kites') in song_list) with self.assertRaises(ValueError): song_list.add_song(song) print(song.as_dict())