34 lines
1.0 KiB
Python
34 lines
1.0 KiB
Python
"""SubPattern.supports_flip/flip_axis 默认值 + AR 两个子模式的翻转声明。"""
|
|
|
|
from app.question_gen.strategy import SubPattern
|
|
from app.question_gen.strategy_action_recognition import AR_SUB_PATTERNS
|
|
|
|
_FLIP_EXPECTED = {
|
|
"temporal_reasoning_failure": "before/after",
|
|
"cross_segment_entity_tracking": "first/last",
|
|
}
|
|
|
|
|
|
def test_sub_pattern_defaults_no_flip():
|
|
sp = SubPattern(
|
|
name="x", weight=1.0, sampling_level_override=None,
|
|
constraint_override=None, instruction="i",
|
|
)
|
|
assert sp.supports_flip is False
|
|
assert sp.flip_axis is None
|
|
|
|
|
|
def test_ar_flip_declarations():
|
|
by_name = {sp.name: sp for sp in AR_SUB_PATTERNS}
|
|
for name, axis in _FLIP_EXPECTED.items():
|
|
assert by_name[name].supports_flip is True, name
|
|
assert by_name[name].flip_axis == axis, name
|
|
|
|
|
|
def test_other_ar_sub_patterns_keep_defaults():
|
|
for sp in AR_SUB_PATTERNS:
|
|
if sp.name in _FLIP_EXPECTED:
|
|
continue
|
|
assert sp.supports_flip is False, sp.name
|
|
assert sp.flip_axis is None, sp.name
|