lib: Allow iterating over all tags in a SuperTagStore
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
322dc04dd5
commit
1215db01be
|
@ -91,8 +91,8 @@ class TagSuperStore(TagStore):
|
|||
def init_track(self, parent, name, track):
|
||||
return super().init_track((parent, name), track)
|
||||
|
||||
def tags(self, parent):
|
||||
def tags(self, parent=None):
|
||||
with self.lock:
|
||||
for (name, tag) in self.store.items():
|
||||
if tag.parent == parent:
|
||||
if parent == None or tag.parent == parent:
|
||||
yield tag
|
||||
|
|
|
@ -149,6 +149,8 @@ class TestTagSuperStore(unittest.TestCase):
|
|||
self.assertEqual(result, [ tag1, tag2 ])
|
||||
result = [ tag for tag in superstore.tags(parent2) ]
|
||||
self.assertEqual(result, [ tag3 ])
|
||||
result = [ tag for tag in superstore.tags() ]
|
||||
self.assertEqual(result, [ tag1, tag2, tag3 ])
|
||||
|
||||
def test_tag_superstore_init_track(self):
|
||||
store = tagstore.TagStore()
|
||||
|
|
Loading…
Reference in New Issue