diff options
Diffstat (limited to 'src/third_party/wiredtiger/test/3rdparty/testtools-0.9.34/testtools/tags.py')
-rw-r--r-- | src/third_party/wiredtiger/test/3rdparty/testtools-0.9.34/testtools/tags.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/third_party/wiredtiger/test/3rdparty/testtools-0.9.34/testtools/tags.py b/src/third_party/wiredtiger/test/3rdparty/testtools-0.9.34/testtools/tags.py new file mode 100644 index 00000000000..b55bd38667b --- /dev/null +++ b/src/third_party/wiredtiger/test/3rdparty/testtools-0.9.34/testtools/tags.py @@ -0,0 +1,34 @@ +# Copyright (c) 2012 testtools developers. See LICENSE for details. + +"""Tag support.""" + + +class TagContext(object): + """A tag context.""" + + def __init__(self, parent=None): + """Create a new TagContext. + + :param parent: If provided, uses this as the parent context. Any tags + that are current on the parent at the time of construction are + current in this context. + """ + self.parent = parent + self._tags = set() + if parent: + self._tags.update(parent.get_current_tags()) + + def get_current_tags(self): + """Return any current tags.""" + return set(self._tags) + + def change_tags(self, new_tags, gone_tags): + """Change the tags on this context. + + :param new_tags: A set of tags to add to this context. + :param gone_tags: A set of tags to remove from this context. + :return: The tags now current on this context. + """ + self._tags.update(new_tags) + self._tags.difference_update(gone_tags) + return self.get_current_tags() |