Skip to content

Commit be17a76

Browse files
committed
docs: Improve documentation comment for testplan.Element.has_tags
This was partly motivated by the fact I couldn't immediately see whether the test was an AND or an OR. Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
1 parent 09521c6 commit be17a76

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

src/dvsim/testplan.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,18 +101,19 @@ def _validate(self) -> None:
101101
msg = f"'tags' key in {self} is not a list."
102102
raise ValueError(msg)
103103

104-
def has_tags(self, tags: set) -> bool:
105-
"""Checks if the provided tags match the tags originally set.
104+
def has_tags(self, tags: set[str]) -> bool:
105+
"""Return true if the element matches the provided tags.
106106
107-
tags is a list of tags that are we are filtering this testpoints with.
108-
Tags may be preceded with `-` to exclude the testpoints that contain
109-
that tag.
107+
The element should match every item in the set of tags. If one of these
108+
items is preceded with "-", the meaning is negated (so the element
109+
should not match the tag name).
110110
111-
Vacuously returns true if tags is an empty list.
112-
"""
113-
if not tags:
114-
return True
111+
If tags is empty, this will vacuously return true.
112+
113+
Args:
114+
tags: The set of named tags against which to match.
115115
116+
"""
116117
for tag in tags:
117118
if tag.startswith("-"):
118119
if tag[1:] in self.tags:

0 commit comments

Comments
 (0)