def test_playlists_tag(self): # Arguably belongs in _audio songs = NUMERIC_SONGS Playlist._remove_all() Playlist._clear_global_cache() pl_name="playlist 123!" pl = Playlist(self.temp, pl_name) pl.extend(songs) for song in songs: self.assertEquals(pl_name, song("~playlists"))
def test_playlists_featuring(s): Playlist._remove_all() Playlist._clear_global_cache() pl = Playlist(s.temp, "playlist") pl.extend(NUMERIC_SONGS) playlists = Playlist.playlists_featuring(NUMERIC_SONGS[0]) s.failUnlessEqual(playlists, set([pl])) # Now add a second one, check that instance tracking works pl2 = Playlist(s.temp, "playlist2") pl2.append(NUMERIC_SONGS[0]) playlists = Playlist.playlists_featuring(NUMERIC_SONGS[0]) s.failUnlessEqual(playlists, set([pl, pl2]))
def setup(): Playlist._remove_all() for i in xrange(NUM_PLAYLISTS): pls.append(Playlist(PLAYLISTS, "List %d" % (i+1))) for i in xrange(NUM_SONGS): a = ARTISTS[randint(0,2)] t = "Song %d" % i data = {"title": t, "artist":a, "~#tracknumber": i % 20, "~filename": "%s.mp3" % t, "~#filesize":randint(1000000,100000000)} song = Fakesong(data) library.append(song) if not (i % SONGS_TO_PLAYLIST_SIZE_RATIO): song["~included"] = "yes" for j in range(PLAYLISTS_PER_PLAYLISTED_SONG): pls[(i+j) % NUM_PLAYLISTS].append(song)