curds: Add a reset function to the playlist node

This is mostly just used for testing

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2019-04-16 13:37:26 -04:00
parent 3c699dddab
commit 3f7a68a37a
2 changed files with 14 additions and 0 deletions

View File

@ -74,3 +74,6 @@ class PlaylistNode:
if n < len(self.children):
return self.children[n]
return None
def reset(self):
self.children.clear()

View File

@ -174,3 +174,14 @@ class TestPlaylistNode(unittest.TestCase):
self.assertIsNone(root.get_node([ 0, 0, 1 ]))
self.assertIsNone(root.get_node([ 0, 1, 0 ]))
self.assertIsNone(root.get_node([ 1, 0, 0 ]))
def test_node_reset(self):
root = node.PlaylistNode()
a = node.PlaylistNode("a")
b = node.PlaylistNode("b")
root.append_child(a)
root.append_child(b)
root.reset()
self.assertEqual(root.children, [ ])