fix: extend correctness fail-fast to test-side pool questions (P5)
This commit is contained in:
@@ -71,6 +71,27 @@ def test_invalid_assignment_value_fails_fast():
|
||||
)
|
||||
|
||||
|
||||
def test_val_ratio_out_of_range_fails_fast():
|
||||
"""val_ratio 越界(<0 或 >1)时 fail-fast。"""
|
||||
qs = [_q("v1-1", "v1")]
|
||||
assignment = {"v1": "trainval"}
|
||||
correctness = {"v1-1": True}
|
||||
for bad in (-0.1, 1.5):
|
||||
with pytest.raises(ValueError, match="val_ratio"):
|
||||
split_by_video_assignment(
|
||||
qs, assignment, correctness=correctness, val_ratio=bad, seed=0
|
||||
)
|
||||
|
||||
|
||||
def test_missing_correctness_on_test_side_fails_fast():
|
||||
"""test 侧某题缺 correctness 时 fail-fast,不静默兜底 False 污染评估口径。"""
|
||||
qs = [_q("v1-1", "v1"), _q("v2-1", "v2")]
|
||||
assignment = {"v1": "trainval", "v2": "test"}
|
||||
correctness = {"v1-1": True} # 缺 test 侧 v2-1
|
||||
with pytest.raises(ValueError, match="correctness"):
|
||||
split_by_video_assignment(qs, assignment, correctness=correctness, val_ratio=0.0, seed=0)
|
||||
|
||||
|
||||
def test_video_group_atomic_in_trainval_split():
|
||||
"""trainval 内 val 切分以视频组为原子:同 video 的题整组同落 train 或 val。"""
|
||||
qs = [
|
||||
|
||||
Reference in New Issue
Block a user