lib: Give Tags support for the str() function

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2021-06-21 14:57:01 -04:00
parent a6a35f37e7
commit 51fff44746
2 changed files with 5 additions and 0 deletions

View File

@ -26,6 +26,9 @@ class Tag:
self.widgets = None
self.lock = threading.Lock()
def __str__(self):
return self.name
def add_track(self, track):
with self.lock:
self.tracks.append(track)

View File

@ -11,6 +11,8 @@ class TestTag(unittest.TestCase):
self.assertIsNone(t.widgets)
self.assertIsInstance(t.lock, type(threading.Lock()))
self.assertEqual(str(t), "test")
def test_tag_len(self):
t = tag.Tag("Test")
self.assertEqual(len(t), 0)