@@ 614,7 614,7 @@ def _eq(field: str, value: Any, document
"""
try:
return document.get(field, None) == value
- except TypeError:
+ except (TypeError, AttributeError):
return False
@@ 728,6 728,10 @@ class TestCollection:
document = {"foo": 5}
assert not nosqlite._eq("foo", "bar", document)
+ def test_eq_attribute_error(self):
+ document = None # This will trigger AttributeError in _eq function
+ assert not nosqlite._eq("foo", "bar", document)
+
def test_gt_type_error(self):
document = {"foo": "bar"}
assert not nosqlite._gt("foo", 5, document)