summaryrefslogtreecommitdiffstats
path: root/contrib/python/traitlets/py3/tests
diff options
context:
space:
mode:
authorrobot-piglet <[email protected]>2024-05-05 00:00:39 +0300
committerrobot-piglet <[email protected]>2024-05-05 00:08:46 +0300
commitdf380d8d58748e4375664b1a5fe521cd717db4a9 (patch)
tree8f71c0812fc01d5bcd46efabcc22c173154675ef /contrib/python/traitlets/py3/tests
parent0d7e1329b8f47f4ab8450c2cbc05654e10a214fc (diff)
Intermediate changes
Diffstat (limited to 'contrib/python/traitlets/py3/tests')
-rw-r--r--contrib/python/traitlets/py3/tests/test_traitlets.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/contrib/python/traitlets/py3/tests/test_traitlets.py b/contrib/python/traitlets/py3/tests/test_traitlets.py
index dfcf3f0f4b5..f9f623b4ae6 100644
--- a/contrib/python/traitlets/py3/tests/test_traitlets.py
+++ b/contrib/python/traitlets/py3/tests/test_traitlets.py
@@ -1658,6 +1658,24 @@ class TestList(TraitTestBase):
return value
+class SetTrait(HasTraits):
+ value = Set(Unicode())
+
+
+class TestSet(TraitTestBase):
+ obj = SetTrait()
+
+ _default_value: t.Set[str] = set()
+ _good_values = [{"a", "b"}, "ab"]
+ _bad_values = [1]
+
+ def coerce(self, value):
+ if isinstance(value, str):
+ # compatibility handling: convert string to set containing string
+ value = {value}
+ return value
+
+
class Foo:
pass