tags: some clarification and new tests
This commit is contained in:
parent
dc3f3dc168
commit
a093f9b867
@ -77,7 +77,8 @@ def match_tags(tags: set[Tag], tags_or: Optional[set[Tag]], tags_and: Optional[s
|
||||
i. e. you can select a TagLine if it either contains one of the tags in 'tags_or'
|
||||
or all of the tags in 'tags_and' but it must never contain any of the tags in
|
||||
'tags_not'. If 'tags_or' and 'tags_and' are 'None', they match all tags (tag
|
||||
exclusion is still done if 'tags_not' is not 'None').
|
||||
exclusion is still done if 'tags_not' is not 'None'). If they are empty (set()),
|
||||
they match no tags.
|
||||
"""
|
||||
required_tags_present = False
|
||||
excluded_tags_missing = False
|
||||
|
||||
@ -144,3 +144,20 @@ class TestTagLine(CmmTestCase):
|
||||
# Test case 9: 'tags_or' and 'tags_and' are None, match all tags except excluded tags
|
||||
tags_not = {Tag('tag2')}
|
||||
self.assertFalse(tagline.match_tags(None, None, tags_not))
|
||||
|
||||
# Test case 10: 'tags_or' and 'tags_and' are empty, match no tags
|
||||
self.assertFalse(tagline.match_tags(set(), set(), None))
|
||||
|
||||
# Test case 11: 'tags_or' is empty, match no tags
|
||||
self.assertFalse(tagline.match_tags(set(), None, None))
|
||||
|
||||
# Test case 12: 'tags_and' is empty, match no tags
|
||||
self.assertFalse(tagline.match_tags(None, set(), None))
|
||||
|
||||
# Test case 13: 'tags_or' is empty, match 'tags_and'
|
||||
tags_and = {Tag('tag1'), Tag('tag2')}
|
||||
self.assertTrue(tagline.match_tags(None, tags_and, None))
|
||||
|
||||
# Test case 14: 'tags_and' is empty, match 'tags_or'
|
||||
tags_or = {Tag('tag1'), Tag('tag2')}
|
||||
self.assertTrue(tagline.match_tags(tags_or, None, None))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user