Skip to content

Commit ecd5b56

Browse files
committed
test(query_list): fix test assertions to match expected behavior
why: Tests were asserting incorrect behavior for parse_lookup and lookup_contains what: - Updated parse_lookup test to use non-existent field - Fixed lookup_contains test to match string containment behavior - Added test for case-insensitive string containment
1 parent 2edb76f commit ecd5b56

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tests/_internal/test_query_list.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ def test_keygetter_error_handling() -> None:
319319
def test_parse_lookup_error_handling() -> None:
320320
"""Test error handling in parse_lookup function."""
321321
# Test with invalid object
322-
assert parse_lookup({"field": "value"}, "field__contains", "__contains") is None
322+
assert parse_lookup({"field": "value"}, "nonexistent__invalid", "__invalid") is None
323323

324324
# Test with invalid lookup
325325
obj: dict[str, str] = {"field": "value"}
@@ -343,12 +343,12 @@ def test_lookup_functions_edge_cases() -> None:
343343

344344
# Test lookup_contains with various types
345345
assert lookup_contains(["a", "b"], "a")
346-
assert not lookup_contains("123", "1")
346+
assert lookup_contains("123", "1") # String contains substring
347347
assert lookup_contains({"a": "1", "b": "2"}, "a")
348348

349349
# Test lookup_icontains with various types
350-
assert not lookup_icontains("123", "1")
351350
assert lookup_icontains("TEST", "test")
351+
assert lookup_icontains("test", "TEST")
352352
# Keys are case-insensitive
353353
assert lookup_icontains({"A": "1", "b": "2"}, "a")
354354

0 commit comments

Comments
 (0)