parent
98a4f58134
commit
c567334c92
@ -1340,7 +1340,7 @@ class Var:
|
|||||||
Returns:
|
Returns:
|
||||||
A var representing the contain check.
|
A var representing the contain check.
|
||||||
"""
|
"""
|
||||||
if not (types._issubclass(self._var_type, Union[dict, list, tuple, str])):
|
if not (types._issubclass(self._var_type, Union[dict, list, tuple, str, set])):
|
||||||
raise TypeError(
|
raise TypeError(
|
||||||
f"Var {self._var_full_name} of type {self._var_type} does not support contains check."
|
f"Var {self._var_full_name} of type {self._var_type} does not support contains check."
|
||||||
)
|
)
|
||||||
|
@ -415,6 +415,7 @@ def test_basic_operations(TestObj):
|
|||||||
"var, expected",
|
"var, expected",
|
||||||
[
|
[
|
||||||
(v([1, 2, 3]), "[1, 2, 3]"),
|
(v([1, 2, 3]), "[1, 2, 3]"),
|
||||||
|
(v(set([1, 2, 3])), "[1, 2, 3]"),
|
||||||
(v(["1", "2", "3"]), '["1", "2", "3"]'),
|
(v(["1", "2", "3"]), '["1", "2", "3"]'),
|
||||||
(BaseVar(_var_name="foo", _var_type=list)._var_set_state("state"), "state.foo"),
|
(BaseVar(_var_name="foo", _var_type=list)._var_set_state("state"), "state.foo"),
|
||||||
(BaseVar(_var_name="foo", _var_type=list), "foo"),
|
(BaseVar(_var_name="foo", _var_type=list), "foo"),
|
||||||
@ -918,7 +919,6 @@ def test_unsupported_types_for_reverse(var):
|
|||||||
BaseVar(_var_name="var", _var_type=int),
|
BaseVar(_var_name="var", _var_type=int),
|
||||||
BaseVar(_var_name="var", _var_type=float),
|
BaseVar(_var_name="var", _var_type=float),
|
||||||
BaseVar(_var_name="var", _var_type=bool),
|
BaseVar(_var_name="var", _var_type=bool),
|
||||||
BaseVar(_var_name="var", _var_type=set),
|
|
||||||
BaseVar(_var_name="var", _var_type=None),
|
BaseVar(_var_name="var", _var_type=None),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user