Spaces:
Sleeping
Sleeping
File size: 2,373 Bytes
5db30ac | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | import sys
import unittest
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
SRC = ROOT / "src"
if str(SRC) not in sys.path:
sys.path.insert(0, str(SRC))
from elbench.config import load_project_config # noqa: E402
from elbench.execution import PreflightRunner # noqa: E402
from elbench.execution.selection import resolve_module_selection # noqa: E402
class PreflightSmokeTest(unittest.TestCase):
def test_default_module_selection_includes_all_four_modules(self) -> None:
config = load_project_config(ROOT / "configs")
selection = resolve_module_selection(config, None)
self.assertIn("安全可信", selection.selected_modules)
self.assertIn("高阶育人", selection.selected_modules)
self.assertIn("通用模型", selection.selected_modules)
self.assertIn("基本教育", selection.selected_modules)
self.assertTrue(selection.include_basic_education)
def test_preflight_accepts_real_judge_for_official_run(self) -> None:
config = load_project_config(ROOT / "configs")
runner = PreflightRunner(config)
report = runner.run(
model_id="gpt-5.4",
modules={"安全可信"},
source_files={"安全拒答.jsonl"},
require_real_judges=True,
)
self.assertTrue(report.ok)
def test_preflight_allows_mock_judge_for_local_smoke(self) -> None:
config = load_project_config(ROOT / "configs")
runner = PreflightRunner(config)
report = runner.run(
model_id="mock.default",
modules={"通用模型"},
source_files={"mmlu_pro_sampled.jsonl"},
max_samples=1,
require_real_judges=False,
)
self.assertTrue(report.ok)
self.assertEqual(report.total_samples, 1)
self.assertIn("通用模型", report.by_module)
def test_preflight_accepts_real_basic_education_test_endpoint_for_official_run(self) -> None:
config = load_project_config(ROOT / "configs")
runner = PreflightRunner(config)
report = runner.run(
model_id="gpt-5.4",
modules={"基本教育"},
source_files={"config_guided_task.yaml"},
require_real_judges=True,
)
self.assertTrue(report.ok)
if __name__ == "__main__":
unittest.main()
|