fix(question_gen): sample_anchor Codex 审查修正
- C1/C2: Temporal Reasoning ≥3 L2 + Object Reasoning ≥2 L2 下限检查 - I1: L2 题型子帧不足时 ValueError - I2: L3 过滤无 frame_path 的节点 - I3/I4: distractor_texts 扩展到整棵树范围 - I5-I7: 测试补强 Information Synopsis/Temporal Reasoning/Object Reasoning - M1: Spatial Reasoning 测试断言 spatial_layout Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -185,15 +185,15 @@ class TestSampleAnchor:
|
||||
"""Information Synopsis 必须使用目标 L1 下所有 L2 子节点。"""
|
||||
tree, _vid = _load_test_tree()
|
||||
ctx = sample_anchor(tree, "Information Synopsis", set(), random.Random(42))
|
||||
# 至少应有帧(每个 L2 取一帧代表)
|
||||
total_l2 = sum(len(r.children) for r in tree.roots)
|
||||
assert len(ctx.frame_paths) >= min(total_l2, 1)
|
||||
# 找到被选中的 L1,验证 frame_paths 数量 == 该 L1 下全部 L2 数量
|
||||
chosen_l1 = next(r for r in tree.roots if r.id == ctx.node_id)
|
||||
assert len(ctx.frame_paths) == len(chosen_l1.children)
|
||||
|
||||
def test_l1_type_l2_nodes_in_time_order(self) -> None:
|
||||
"""L1 题型(Temporal Reasoning)的 card_text 应有实质内容。"""
|
||||
"""Temporal Reasoning 应返回 >=3 帧且 card_text 有实质内容。"""
|
||||
tree, _vid = _load_test_tree()
|
||||
ctx = sample_anchor(tree, "Temporal Reasoning", set(), random.Random(42))
|
||||
assert len(ctx.frame_paths) >= 1
|
||||
assert len(ctx.frame_paths) >= 3
|
||||
assert len(ctx.card_text) > 20
|
||||
|
||||
def test_used_node_ids_excluded(self) -> None:
|
||||
@@ -219,12 +219,13 @@ class TestSampleAnchor:
|
||||
"""Object Reasoning (L1-L2) 应选 2-3 个 L2 并按时间排序。"""
|
||||
tree, _vid = _load_test_tree()
|
||||
ctx = sample_anchor(tree, "Object Reasoning", set(), random.Random(42))
|
||||
assert 1 <= len(ctx.frame_paths) <= 3
|
||||
assert 2 <= len(ctx.frame_paths) <= 3
|
||||
assert len(ctx.card_text) > 10
|
||||
|
||||
def test_spatial_reasoning_context_fields(self) -> None:
|
||||
"""Spatial Reasoning 的 card_text 应包含 spatial_layout 内容。"""
|
||||
"""Spatial Reasoning 的 card_text 应包含 spatial_layout 字段。"""
|
||||
tree, _vid = _load_test_tree()
|
||||
ctx = sample_anchor(tree, "Spatial Reasoning", set(), random.Random(42))
|
||||
# context_fields 包含 spatial_layout,card_text 应含有该字段内容
|
||||
# context_fields 包含 spatial_layout,card_text 必须出现该字段名
|
||||
assert "spatial_layout" in ctx.card_text
|
||||
assert len(ctx.card_text) > 20
|
||||
|
||||
Reference in New Issue
Block a user