Compare commits
2 Commits
ebac55b7a8
...
47ca1037db
| Author | SHA1 | Date | |
|---|---|---|---|
| 47ca1037db | |||
| a125fe7d42 |
@ -113,16 +113,14 @@ class TagLine(str):
|
||||
Note that it's sufficient if the TagLine matches one of 'tags_or' or 'tags_and',
|
||||
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 a given tag set is 'None', it matches all tags.
|
||||
'tags_not'.
|
||||
"""
|
||||
tag_set = self.tags()
|
||||
required_tags_present = False
|
||||
excluded_tags_missing = False
|
||||
if ((tags_or is None and tags_and is None)
|
||||
or (tags_or and any(tag in tag_set for tag in tags_or)) # noqa: W503
|
||||
if ((tags_or and any(tag in tag_set for tag in tags_or))
|
||||
or (tags_and and all(tag in tag_set for tag in tags_and))): # noqa: W503
|
||||
required_tags_present = True
|
||||
if ((tags_not is None)
|
||||
or (not any(tag in tag_set for tag in tags_not))): # noqa: W503
|
||||
if not any(tag in tag_set for tag in tags_not):
|
||||
excluded_tags_missing = True
|
||||
return required_tags_present and excluded_tags_missing
|
||||
|
||||
@ -333,7 +333,7 @@ class TestTagLine(CmmTestCase):
|
||||
self.assertFalse(tagline.match_tags(tags_or, tags_and, tags_not))
|
||||
|
||||
# Test case 7: Some tags in 'tags_not' are present
|
||||
tags_or = {Tag('tag1')}
|
||||
tags_or = set()
|
||||
tags_and = set()
|
||||
tags_not = {Tag('tag2')}
|
||||
self.assertFalse(tagline.match_tags(tags_or, tags_and, tags_not))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user