curds: Remove the PlaylistPlaceholder

It is no longer needed

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2019-04-17 11:08:15 -04:00
parent b37a36369f
commit 2c779b475d
2 changed files with 2 additions and 23 deletions

View File

@ -50,22 +50,10 @@ class PlaylistManagerBase(list):
self.clear()
class Placeholder(PlaylistManagerBase):
def __init__(self):
PlaylistManagerBase.__init__(self)
def __str__(self):
return ""
def lookup(self, name, allocate=False):
return None
class PlaylistManager(PlaylistManagerBase):
def __init__(self):
self.append(collection.CollectionPlaylist())
self.append(previous.PreviousPlaylist())
self.append(Placeholder())
self.append(genre.GenreNode())
self.append(library.LibraryNode())
self.current = [ self.lookup("Collection") ]

View File

@ -64,23 +64,14 @@ class TestPlaylistManager(unittest.TestCase):
self.assertEqual( self.playman[0], self.playman.lookup("Collection"))
self.assertEqual( self.playman[1], self.playman.lookup("Previous"))
self.assertIsInstance(self.playman[2], manager.Placeholder)
self.assertEqual( self.playman[3], self.playman.lookup("Genres"))
self.assertEqual( self.playman[4], self.playman.lookup("Libraries"))
self.assertEqual( self.playman[2], self.playman.lookup("Genres"))
self.assertEqual( self.playman[3], self.playman.lookup("Libraries"))
self.assertIsNone(self.playman[999])
for i in range(len(self.playman)):
self.assertEqual(self.playman.index(self.playman[i]), i)
self.assertIsNone(self.playman.index(plist))
def test_manager_placeholders(self):
place = manager.Placeholder()
self.assertEqual(place.name, "")
self.assertEqual(place.icon, "")
self.assertEqual(str(place), "")
self.assertIsNone(place.lookup("Test", allocate=True))
self.assertEqual(len(place), 0)
def test_manager_on_scan(self):
plist = self.playman.lookup("Libraries").lookup(test_library)
alist = self.playman.lookup("Libraries").lookup(test_album)