evalstone/evalscope/tests/report/test_report_ref.py
sora 13274243a0 Bump vendored EvalScope and add K3-ready DPV4 configs.
Keep K3 suite selection and report-schema scoring in bash, merge K3/vision dataset_args into dpv4 yamls, and pin EvalScope at 735d920ee911 with local patches.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-02 07:30:48 +00:00

42 lines
1.4 KiB
Python

# Copyright (c) Alibaba, Inc. and its affiliates.
"""Unit tests for the ReportRef identity contract."""
import pytest
from evalscope.report import ReportRef
def test_key_and_parse_round_trip() -> None:
ref = ReportRef(run_id='20260811_152001', model_id='qwen-plus')
assert ref.key == '20260811_152001/qwen-plus'
assert ReportRef.parse(ref.key) == ref
assert str(ref) == ref.key
def test_parse_splits_on_the_first_separator() -> None:
# Everything after the first separator is the model id; a model id never spans two segments in
# practice, but the split contract keeps the run id unambiguous.
ref = ReportRef.parse('run/model')
assert ref.run_id == 'run'
assert ref.model_id == 'model'
def test_parse_rejects_a_value_without_a_separator() -> None:
with pytest.raises(ValueError):
ReportRef.parse('run-only')
@pytest.mark.parametrize('bad', ['', '.', '..'])
def test_rejects_empty_and_dot_segments(bad: str) -> None:
with pytest.raises(ValueError):
ReportRef(run_id=bad, model_id='model')
with pytest.raises(ValueError):
ReportRef(run_id='run', model_id=bad)
@pytest.mark.parametrize('bad', ['a/b', 'a\\b'])
def test_rejects_path_separators(bad: str) -> None:
with pytest.raises(ValueError):
ReportRef(run_id=bad, model_id='model')
with pytest.raises(ValueError):
ReportRef(run_id='run', model_id=bad)