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:
parent
3c699dddab
commit
3f7a68a37a
|
@ -74,3 +74,6 @@ class PlaylistNode:
|
|||
if n < len(self.children):
|
||||
return self.children[n]
|
||||
return None
|
||||
|
||||
def reset(self):
|
||||
self.children.clear()
|
||||
|
|
|
@ -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, [ ])
|
||||
|
|
Loading…
Reference in New Issue