curds: Make it possible to cast nodes into a string
We'll use this do display the node in the UI. I add a newline so we don't have to implement some kind of spacer class. Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
261b08f3f4
commit
0ea715a6d5
|
@ -23,6 +23,9 @@ class PlaylistNode:
|
|||
def __normalize__(self, name):
|
||||
return name.title()
|
||||
|
||||
def __str__(self):
|
||||
return f"<small>\n</small><big>{self.name}</big>"
|
||||
|
||||
def append_child(self, child):
|
||||
prev = None
|
||||
if len(self.children) > 0:
|
||||
|
|
|
@ -14,6 +14,7 @@ class TestPlaylistNode(unittest.TestCase):
|
|||
n = node.PlaylistNode("test node", "test-icon")
|
||||
self.assertEqual(n.icon, "test-icon")
|
||||
self.assertEqual(n.name, "Test Node")
|
||||
self.assertEqual(str(n), "<small>\n</small><big>Test Node</big>")
|
||||
|
||||
def test_node_less_than(self):
|
||||
a = node.PlaylistNode("a")
|
||||
|
|
Loading…
Reference in New Issue