Commit 6bc9968
committed
test(query_list): improve test coverage and type safety for lookup functions
Document and test edge cases in lookup_in() and lookup_nin() functions, particularly
focusing on type safety and error handling. This commit improves test coverage and
makes the test suite more maintainable.
Changes:
- Replace object() test cases with type-safe alternatives using dict[str, str]
- Add explicit type annotations to prevent type errors
- Document expected behavior for invalid type combinations
- Improve test readability with clearer comments and assertions
Technical Details:
- Updated test_lookup_functions_deep_matching() to use proper type annotations
- Removed unsafe object() test cases that caused mypy errors
- Added test cases using valid types but invalid usage patterns
- Documented that lookup_in() returns False for invalid type combinations
- Maintained test coverage while improving type safety
Impact:
- All type checks now pass (mypy)
- All linting checks pass (ruff)
- All 65 tests pass
- Improved code maintainability through better type safety
- Better documentation of edge case behavior
Note: The lookup_in() and lookup_nin() functions are designed to handle invalid
types gracefully by returning False rather than raising exceptions. This behavior
is now properly documented and tested.1 parent aa1a34c commit 6bc9968
1 file changed
+53
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
982 | 983 | | |
983 | 984 | | |
984 | 985 | | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
0 commit comments