test: guard non-AR flip isolation and AR flip-capable set
This commit is contained in:
@@ -31,3 +31,29 @@ def test_other_ar_sub_patterns_keep_defaults():
|
||||
continue
|
||||
assert sp.supports_flip is False, sp.name
|
||||
assert sp.flip_axis is None, sp.name
|
||||
|
||||
|
||||
def test_non_ar_strategies_have_no_flip_capable_sub_pattern():
|
||||
"""非 AR 题型走 BaseTaskTypeStrategy,无 SubPattern(select_sub_pattern 返回 None),
|
||||
故不存在 flip-capable 子模式——翻转门对它们天然跳过。"""
|
||||
import random
|
||||
from app.question_gen.strategy import get_strategy
|
||||
|
||||
non_ar = [
|
||||
"Action Reasoning", "Attribute Perception", "Counting Problem",
|
||||
"Information Synopsis", "Object Recognition", "Object Reasoning",
|
||||
"OCR Problems", "Spatial Perception", "Spatial Reasoning",
|
||||
"Temporal Perception", "Temporal Reasoning",
|
||||
]
|
||||
rng = random.Random(0)
|
||||
for tt in non_ar:
|
||||
assert get_strategy(tt).select_sub_pattern(rng) is None, tt
|
||||
|
||||
|
||||
def test_only_two_ar_sub_patterns_support_flip():
|
||||
"""全 6 个 AR SubPattern 中恰有 2 个 supports_flip=True,其余 4 个默认 False。"""
|
||||
from app.question_gen.strategy_action_recognition import AR_SUB_PATTERNS
|
||||
|
||||
flip_names = {sp.name for sp in AR_SUB_PATTERNS if sp.supports_flip}
|
||||
assert flip_names == {"temporal_reasoning_failure", "cross_segment_entity_tracking"}
|
||||
assert all(sp.flip_axis is None for sp in AR_SUB_PATTERNS if not sp.supports_flip)
|
||||
|
||||
Reference in New Issue
Block a user