test: align scoring fixtures and upgrade checks with current contracts
This commit is contained in:
@@ -136,7 +136,7 @@ def test_scoring_uses_the_same_page_image_as_its_saved_evidence(db, environment)
|
||||
sent_images.extend(images or [])
|
||||
return ScoreResult(criterion_id=criterion["criterion_id"], score=1,
|
||||
max_score=criterion["max_score"], reason="测试评分",
|
||||
evidence=[{"chunk_id": chunk.id, "page": 2, "quote": "原文证据"}], confidence=.9)
|
||||
evidence=[{"chunk_id": chunk.id, "page": 2, "quote": "原文证据", "target_id": "t0"}], confidence=.9)
|
||||
|
||||
# The evidence page must be a substantive body page: a contents page cannot support
|
||||
# a content judgement, so the source page is classified accordingly during ingest.
|
||||
|
||||
@@ -388,7 +388,8 @@ def test_upgrade_from_legacy_0003_migrates_pages_and_citations(session_factory,
|
||||
config.set_main_option('script_location', str(root / 'migrations'))
|
||||
command.upgrade(config, 'head')
|
||||
with session_factory() as db:
|
||||
assert db.scalar(text('SELECT version_num FROM alembic_version')) == '0006'
|
||||
from alembic.script import ScriptDirectory
|
||||
assert db.scalar(text('SELECT version_num FROM alembic_version')) == ScriptDirectory.from_config(config).get_current_head()
|
||||
assert db.get(Conversation, conversation_id).title == '旧记录'
|
||||
assert db.scalar(select(ChatMessage.content).where(ChatMessage.conversation_id == conversation_id)) == '旧问题'
|
||||
run = db.scalar(select(AgentRun).where(AgentRun.conversation_id == conversation_id))
|
||||
|
||||
@@ -428,13 +428,14 @@ def test_project_and_version_isolation_is_unchanged(db):
|
||||
def test_batch_snapshot_records_the_evidence_policy(db):
|
||||
from types import SimpleNamespace
|
||||
from wisegrade import services
|
||||
from wisegrade.evidence import POLICY_VERSION
|
||||
from wisegrade.models import ScoringBatch
|
||||
|
||||
created = services.create_batch(SimpleNamespace(course_version_id=1, rubric_version_id=1), db)
|
||||
assert created["id"]
|
||||
batch = db.get(ScoringBatch, created["id"])
|
||||
plan = batch.rubric_snapshot["evidence_plan"]
|
||||
assert plan["version"] == 1
|
||||
assert plan["version"] == POLICY_VERSION
|
||||
assert plan["content_allowed_page_types"] == ["body", "appendix"]
|
||||
targets = plan["criteria"]["stage3.data"]
|
||||
assert [target["use"] for target in targets] == ["content", "content"]
|
||||
|
||||
Reference in New Issue
Block a user