curds: Make sure we're properly setting prev / next pointers

I noticed that the toplevel playlist siblings were always set to None,
so make sure we're properly setting these so they can be used.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2019-04-21 10:16:03 -04:00
parent de9c7b0745
commit 33e2af2c2d
2 changed files with 5 additions and 2 deletions

View File

@ -11,12 +11,12 @@ class PlaylistNode:
self.prev_child = None
def __link_children__(self, a, b, c):
if a:
if a != None:
a.next_child = b
b.parent = self
b.prev_child = a
b.next_child = c
if c:
if c != None:
c.prev_child = b
def __lt__(self, rhs):

View File

@ -67,6 +67,9 @@ class TestPlaylistManager(unittest.TestCase):
self.assertEqual(self.playman.nth_child(4), self.playman.lookup("Decades"))
self.assertEqual(self.playman.nth_child(5), self.playman.lookup("Libraries"))
for i, plist in enumerate(self.playman.children):
self.assertEqual(plist.next_child, self.playman.nth_child(i + 1))
self.assertEqual(self.playman.name, "Root")
self.assertEqual(self.playman.current, [ self.playman.lookup("Collection") ])
self.assertEqual(self.playman.track, None)