test: assert unregistered id-field queries actually match nothing

test_unregistered_id_field_folds_to_literal_text_not_error only checked
that parse_user_query() didn't raise for a query like tag_id:5. Add a
result-level acceptance test (matching test_acceptance.py's
_matched_ids pattern, indexed against real documents) that asserts the
matched-document-ID set is genuinely empty, not just that the parse
step succeeds.
This commit is contained in:
Trenton Holmes
2026-08-19 13:36:53 -07:00
committed by stumpylog
parent f5e7d309af
commit 35917be2d4
2 changed files with 19 additions and 0 deletions
+3
View File
@@ -152,6 +152,9 @@ class TestParseUserQuery:
) -> None:
# tag_id is intentionally excluded from the FieldRegistry — whoosh-compat
# parity leniency folds it into literal text, not a diagnostic/400.
# A result-level assertion that this fold actually matches nothing
# against real documents lives in
# test_acceptance.py::TestUnregisteredIdFieldFoldsToLiteralText.
q = parse_user_query(query_index, "tag_id:5", UTC)
assert isinstance(q, tantivy.Query)