File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ from weaviate .str_enum import BaseEnum
2+
3+
4+ class _Color (BaseEnum ):
5+ RED = "red"
6+ GREEN = "green"
7+
8+
9+ def test_member_name_string_is_contained ():
10+ # `in` matches by member *name*, so the uppercase name is found.
11+ assert "RED" in _Color
12+ assert "GREEN" in _Color
13+
14+
15+ def test_unknown_string_is_not_contained ():
16+ assert "PURPLE" not in _Color
17+
18+
19+ def test_member_value_string_is_not_a_membership_match ():
20+ # The lowercase *value* is not a member name, so it is not contained.
21+ assert "red" not in _Color
22+
23+
24+ def test_enum_member_is_contained ():
25+ assert _Color .RED in _Color
26+
27+
28+ def test_non_string_non_member_is_not_contained ():
29+ # A non-string that lacks a ``.name`` falls back to the string check
30+ # and is therefore not contained.
31+ assert 12345 not in _Color
You can’t perform that action at this time.
0 commit comments