refactor: minor cleanup from final whoosh-compat migration review

- Update stale test comments in test_query.py that described string
  rewriting / raw-query fallback behavior that no longer exists post
  whoosh-compat migration; rename
  test_date_rewriting_applied_before_tantivy_parse to
  test_date_keyword_resolves_without_raising to match.
- views.py: move the local MultipleSearchQueryErrors import up into the
  existing local-import block near the top of list(), consistent with
  the other documents.search imports there, instead of importing it
  again inside the except SearchQueryError clause.
- test_api_search.py: assert response.status_code explicitly before
  indexing into response.data["results"] in
  test_search_added_previous_month_excludes_next_period_start, and tie
  the xfail marker to AssertionError instead of the incidental KeyError
  that indexing a 400 response's missing "results" key produced.
This commit is contained in:
Trenton Holmes
2026-08-18 11:05:04 -07:00
parent a66237f614
commit 0bf06f89a7
3 changed files with 14 additions and 9 deletions
+5 -1
View File
@@ -731,7 +731,7 @@ class TestDocumentSearchApi(DirectoriesMixin, APITestCase):
"which already quotes. CONFIRMED REGRESSION vs whoosh-compat "
"migration; see task-10-report.md."
),
raises=KeyError,
raises=AssertionError,
)
def test_search_added_previous_month_excludes_next_period_start(self) -> None:
"""
@@ -769,6 +769,10 @@ class TestDocumentSearchApi(DirectoriesMixin, APITestCase):
tick=False,
):
response = self.client.get("/api/documents/?query=added:previous month")
assert response.status_code == 200, (
f"expected a successful search response, got {response.status_code}: "
f"{response.data!r}"
)
results = response.data["results"]
self.assertEqual(len(results), 1)