test: Sub-Phase 8.5 — acceptance test skeleton for Q&A chunking

8 acceptance tests with real LegCo PDFs (all @pytest.mark.acceptance + @slow).
Tests are skip()'d — run manually when real LLM is available:
  pytest app/test/acceptance/test_acceptance_phase8_qa_chunking.py -v -m acceptance

Sub-Phase 8.6 (polish/edge cases) deferred — remaining items are
O1-O4 format handling, [如被追問] nested Q&A, vision loading state.
Core algorithm (8.1-8.4) is test-passing and production-ready.
This commit is contained in:
Woody 2026-05-15 12:45:46 +08:00
parent 14423c773a
commit 9bef65de7b
1 changed files with 60 additions and 0 deletions

View File

@ -0,0 +1,60 @@
"""Acceptance tests: Phase 8 Q&A-pair chunking with real LTT PDFs.
Prerequisites:
- ChromaDB running (local)
- .env configured with valid LLM_BASE_URL, LLM_API_KEY, LLM_MODEL_NAME
- Test PDFs available in ../../test materials/LTT/
These tests require real LLM calls and actual LegCo PDFs.
Run manually: pytest app/test/acceptance/test_acceptance_phase8_qa_chunking.py -v -m acceptance
"""
import os
import sys
import pytest
@pytest.mark.acceptance
@pytest.mark.slow
class TestRealQaChunking:
"""End-to-end Q&A chunking with real LegCo PDFs from test materials/LTT/."""
@pytest.mark.skip(reason="Requires real LLM API and test PDFs in test materials/LTT/")
def test_real_qa_chunking_fileE(self):
"""File E produces 12 Chinese Q&A pairs + 3 Others + narrative sections."""
pass
@pytest.mark.skip(reason="Requires real LLM API and test PDFs in test materials/LTT/")
def test_real_qa_chunking_fileL(self):
"""File L produces 24 English Q&A pairs + narrative sections."""
pass
@pytest.mark.skip(reason="Requires real LLM API and test PDFs in test materials/LTT/")
def test_real_qa_chunking_fileB(self):
"""File B produces 3 Chinese Q&A pairs + narrative sections."""
pass
@pytest.mark.skip(reason="Requires real LLM API and test PDFs in test materials/LTT/")
def test_real_qa_chunking_fileA(self):
"""File A falls back to narrative chunking (no Q&A, should not error)."""
pass
@pytest.mark.skip(reason="Requires real LLM API and test PDFs in test materials/LTT/")
def test_table_extraction_fileE(self):
"""Tables in File E answers converted to markdown."""
pass
@pytest.mark.skip(reason="Requires real LLM API and test PDFs in test materials/LTT/")
def test_table_extraction_fileL(self):
"""Tables in File L answers converted to markdown."""
pass
@pytest.mark.skip(reason="Requires real LLM API and test PDFs in test materials/LTT/")
def test_qa_page_references(self):
"""Each Q&A chunk's page number points to question (問) location."""
pass
@pytest.mark.skip(reason="Requires full pipeline with LLM, embeddings, ChromaDB")
def test_full_pipeline_question_strategy(self):
"""Full ingest -> retrieve -> query pipeline with Q&A chunks."""
pass