From c7b03eb9abd962ea647637a3a3032593e5143f88 Mon Sep 17 00:00:00 2001 From: Yiorgis Gozadinos Date: Thu, 5 Mar 2026 11:44:08 +0200 Subject: [PATCH] Strengthen weak assertions in context enhancement and converter tests - Add doc_item_refs and headings assertions to test_expand_context_docling_merges_metadata - Add page count and markdown content assertions to test_convert_pdf_with_ocr_engine Co-Authored-By: Claude Opus 4.6 --- CHANGELOG.md | 4 ++++ tests/test_context_enhancement.py | 4 ++++ tests/test_converters.py | 2 ++ 3 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 08da66bd..e792c215 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog ## [Unreleased] +### Changed + +- **Test suite cleanup**: Removed stale VCR cassettes, dead fixtures, orphaned directories, and redundant tests. Strengthened weak assertions across search, context enhancement, and converter tests. Relocated misplaced `SearchResult._get_primary_label` test to `test_search.py` + ## [0.33.0] - 2026-03-04 ### Added diff --git a/tests/test_context_enhancement.py b/tests/test_context_enhancement.py index f7a3f0b0..f1a03792 100644 --- a/tests/test_context_enhancement.py +++ b/tests/test_context_enhancement.py @@ -642,6 +642,10 @@ First paragraph of results. assert len(r.content) > 0 # Score should be preserved (best score) assert r.score in [0.9, 0.8] + # Expanded content should have docling refs + assert r.doc_item_refs is not None and len(r.doc_item_refs) > 0 + # Document has headings, expanded result should too + assert r.headings is not None and len(r.headings) > 0 def create_picture_document() -> DoclingDocument: diff --git a/tests/test_converters.py b/tests/test_converters.py index 0ad7026b..7775cf09 100644 --- a/tests/test_converters.py +++ b/tests/test_converters.py @@ -1067,6 +1067,8 @@ class TestDoclingServeConverterIntegration: doc = await converter.convert_file(pdf_path) assert isinstance(doc, DoclingDocument) + assert len(doc.pages) > 0 + assert len(doc.export_to_markdown().strip()) > 100 @pytest.mark.xfail( reason="docling-serve does not return picture image data in JSON response "