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():
|
def test_generated_question_has_sub_pattern_default_none():
|
||||||
q = GeneratedQuestion(
|
q = GeneratedQuestion(
|
||||||
question_id="q1", video_id="v1", task_type="Action Recognition",
|
question_id="q1",
|
||||||
question="?", options=("A. x",), answer="A",
|
video_id="v1",
|
||||||
source_nodes=("n1",), difficulty="easy",
|
task_type="Action Recognition",
|
||||||
|
question="?",
|
||||||
|
options=("A. x",),
|
||||||
|
answer="A",
|
||||||
|
source_nodes=("n1",),
|
||||||
|
difficulty="easy",
|
||||||
)
|
)
|
||||||
assert q.sub_pattern is None
|
assert q.sub_pattern is None
|
||||||
|
|
||||||
|
|
||||||
def test_to_generated_question_threads_sub_pattern():
|
def test_to_generated_question_threads_sub_pattern():
|
||||||
q = _to_generated_question(
|
q = _to_generated_question(
|
||||||
_candidate(), family="ACTION_RECOGNITION",
|
_candidate(),
|
||||||
|
family="ACTION_RECOGNITION",
|
||||||
sub_pattern="premature_evidence_anchoring",
|
sub_pattern="premature_evidence_anchoring",
|
||||||
)
|
)
|
||||||
assert q.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():
|
def test_question_to_entry_includes_sub_pattern():
|
||||||
from tools.generate_questions import _question_to_entry
|
from tools.generate_questions import _question_to_entry
|
||||||
|
|
||||||
q = GeneratedQuestion(
|
q = GeneratedQuestion(
|
||||||
question_id="v1_Action Recognition_0001", video_id="v1",
|
question_id="v1_Action Recognition_0001",
|
||||||
task_type="Action Recognition", question="?",
|
video_id="v1",
|
||||||
options=("A. 蒸", "B. 炒", "C. 煮", "D. 炸"), answer="A",
|
task_type="Action Recognition",
|
||||||
source_nodes=("n1",), difficulty="hard",
|
question="?",
|
||||||
family="ACTION_RECOGNITION", skill_target="M1_AR",
|
options=("A. 蒸", "B. 炒", "C. 煮", "D. 炸"),
|
||||||
|
answer="A",
|
||||||
|
source_nodes=("n1",),
|
||||||
|
difficulty="hard",
|
||||||
|
family="ACTION_RECOGNITION",
|
||||||
|
skill_target="M1_AR",
|
||||||
sub_pattern="temporal_reasoning_failure",
|
sub_pattern="temporal_reasoning_failure",
|
||||||
)
|
)
|
||||||
entry = _question_to_entry(q)
|
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):
|
def test_append_to_json_writes_sub_pattern(tmp_path):
|
||||||
from tools.generate_questions import _append_to_json
|
from tools.generate_questions import _append_to_json
|
||||||
|
|
||||||
q = GeneratedQuestion(
|
q = GeneratedQuestion(
|
||||||
question_id="v1_Action Recognition_0001", video_id="v1",
|
question_id="v1_Action Recognition_0001",
|
||||||
task_type="Action Recognition", question="?",
|
video_id="v1",
|
||||||
options=("A. 蒸", "B. 炒", "C. 煮", "D. 炸"), answer="A",
|
task_type="Action Recognition",
|
||||||
source_nodes=("n1",), difficulty="hard",
|
question="?",
|
||||||
family="ACTION_RECOGNITION", skill_target="M1_AR",
|
options=("A. 蒸", "B. 炒", "C. 煮", "D. 炸"),
|
||||||
|
answer="A",
|
||||||
|
source_nodes=("n1",),
|
||||||
|
difficulty="hard",
|
||||||
|
family="ACTION_RECOGNITION",
|
||||||
|
skill_target="M1_AR",
|
||||||
sub_pattern="temporal_reasoning_failure",
|
sub_pattern="temporal_reasoning_failure",
|
||||||
)
|
)
|
||||||
_append_to_json(tmp_path, q)
|
_append_to_json(tmp_path, q)
|
||||||
import json
|
import json
|
||||||
|
|
||||||
data = json.loads((tmp_path / "v1.json").read_text(encoding="utf-8"))
|
data = json.loads((tmp_path / "v1.json").read_text(encoding="utf-8"))
|
||||||
assert data[0]["sub_pattern"] == "temporal_reasoning_failure"
|
assert data[0]["sub_pattern"] == "temporal_reasoning_failure"
|
||||||
|
|||||||
Reference in New Issue
Block a user