style: format sub_pattern test file
This commit is contained in:
@@ -21,16 +21,22 @@ def _candidate() -> CandidateQuestion:
|
||||
|
||||
def test_generated_question_has_sub_pattern_default_none():
|
||||
q = GeneratedQuestion(
|
||||
question_id="q1", video_id="v1", task_type="Action Recognition",
|
||||
question="?", options=("A. x",), answer="A",
|
||||
source_nodes=("n1",), difficulty="easy",
|
||||
question_id="q1",
|
||||
video_id="v1",
|
||||
task_type="Action Recognition",
|
||||
question="?",
|
||||
options=("A. x",),
|
||||
answer="A",
|
||||
source_nodes=("n1",),
|
||||
difficulty="easy",
|
||||
)
|
||||
assert q.sub_pattern is None
|
||||
|
||||
|
||||
def test_to_generated_question_threads_sub_pattern():
|
||||
q = _to_generated_question(
|
||||
_candidate(), family="ACTION_RECOGNITION",
|
||||
_candidate(),
|
||||
family="ACTION_RECOGNITION",
|
||||
sub_pattern="premature_evidence_anchoring",
|
||||
)
|
||||
assert q.sub_pattern == "premature_evidence_anchoring"
|
||||
@@ -43,12 +49,18 @@ def test_to_generated_question_sub_pattern_defaults_none():
|
||||
|
||||
def test_question_to_entry_includes_sub_pattern():
|
||||
from tools.generate_questions import _question_to_entry
|
||||
|
||||
q = GeneratedQuestion(
|
||||
question_id="v1_Action Recognition_0001", video_id="v1",
|
||||
task_type="Action Recognition", question="?",
|
||||
options=("A. 蒸", "B. 炒", "C. 煮", "D. 炸"), answer="A",
|
||||
source_nodes=("n1",), difficulty="hard",
|
||||
family="ACTION_RECOGNITION", skill_target="M1_AR",
|
||||
question_id="v1_Action Recognition_0001",
|
||||
video_id="v1",
|
||||
task_type="Action Recognition",
|
||||
question="?",
|
||||
options=("A. 蒸", "B. 炒", "C. 煮", "D. 炸"),
|
||||
answer="A",
|
||||
source_nodes=("n1",),
|
||||
difficulty="hard",
|
||||
family="ACTION_RECOGNITION",
|
||||
skill_target="M1_AR",
|
||||
sub_pattern="temporal_reasoning_failure",
|
||||
)
|
||||
entry = _question_to_entry(q)
|
||||
@@ -59,15 +71,22 @@ def test_question_to_entry_includes_sub_pattern():
|
||||
|
||||
def test_append_to_json_writes_sub_pattern(tmp_path):
|
||||
from tools.generate_questions import _append_to_json
|
||||
|
||||
q = GeneratedQuestion(
|
||||
question_id="v1_Action Recognition_0001", video_id="v1",
|
||||
task_type="Action Recognition", question="?",
|
||||
options=("A. 蒸", "B. 炒", "C. 煮", "D. 炸"), answer="A",
|
||||
source_nodes=("n1",), difficulty="hard",
|
||||
family="ACTION_RECOGNITION", skill_target="M1_AR",
|
||||
question_id="v1_Action Recognition_0001",
|
||||
video_id="v1",
|
||||
task_type="Action Recognition",
|
||||
question="?",
|
||||
options=("A. 蒸", "B. 炒", "C. 煮", "D. 炸"),
|
||||
answer="A",
|
||||
source_nodes=("n1",),
|
||||
difficulty="hard",
|
||||
family="ACTION_RECOGNITION",
|
||||
skill_target="M1_AR",
|
||||
sub_pattern="temporal_reasoning_failure",
|
||||
)
|
||||
_append_to_json(tmp_path, q)
|
||||
import json
|
||||
|
||||
data = json.loads((tmp_path / "v1.json").read_text(encoding="utf-8"))
|
||||
assert data[0]["sub_pattern"] == "temporal_reasoning_failure"
|
||||
|
||||
Reference in New Issue
Block a user