File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -496,7 +496,7 @@ def __contains__(self, key: object) -> bool:
496496
497497 This uses key equality so the key must be the same name and type.
498498 """
499- return any (v for k , v in self if k == key )
499+ return any (k == key for k , v in self )
500500
501501 @overload
502502 def get (
Original file line number Diff line number Diff line change @@ -99,6 +99,25 @@ def test_typed_search_attribute_duplicates():
9999 )
100100
101101
102+ def test_typed_search_attributes_contains_with_falsy_value ():
103+ int_key = SearchAttributeKey .for_int ("my-int" )
104+ attrs = TypedSearchAttributes ([SearchAttributePair (int_key , 0 )])
105+ assert int_key in attrs
106+
107+
108+ def test_typed_search_attributes_contains_with_truthy_value ():
109+ int_key = SearchAttributeKey .for_int ("my-int" )
110+ attrs = TypedSearchAttributes ([SearchAttributePair (int_key , 42 )])
111+ assert int_key in attrs
112+
113+
114+ def test_typed_search_attributes_contains_missing_key ():
115+ int_key = SearchAttributeKey .for_int ("my-int" )
116+ missing_key = SearchAttributeKey .for_keyword ("missing" )
117+ attrs = TypedSearchAttributes ([SearchAttributePair (int_key , 42 )])
118+ assert missing_key not in attrs
119+
120+
102121def test_cant_construct_bad_priority ():
103122 with pytest .raises (TypeError ):
104123 Priority (priority_key = 1.1 ) # type: ignore
You can’t perform that action at this time.
0 commit comments