curds: Begin implementing a PlaylistNode

My intention is to try to match the GtkTreeModel interface in terms of
functionality. This way, each node can act as its own iterator.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2019-04-16 07:39:49 -04:00
parent 2ae7ac1aa1
commit ec6744755d
2 changed files with 25 additions and 0 deletions

9
curds/playlist/node.py Normal file
View File

@ -0,0 +1,9 @@
# Copyright 2019 (c) Anna Schumaker.
class PlaylistNode:
def __init__(self, name="", icon=""):
self.children = [ ]
self.icon = icon
self.name = name
self.next = None
self.prev = None

View File

@ -0,0 +1,16 @@
# Copyright 2019 (c) Anna Schumaker.
from . import node
import unittest
class TestPlaylistNode(unittest.TestCase):
def test_node_init(self):
n = node.PlaylistNode()
self.assertEqual( n.children, [ ])
self.assertEqual( n.icon, "")
self.assertEqual( n.name, "")
self.assertIsNone(n.next)
self.assertIsNone(n.prev)
n = node.PlaylistNode("Test Node", "test-icon")
self.assertEqual(n.icon, "test-icon")
self.assertEqual(n.name, "Test Node")