feat: add selectable demo flow tasks

This commit is contained in:
2026-09-02 15:23:15 +08:00
parent f879328562
commit e3dc7ebe21
19 changed files with 871 additions and 110 deletions

View File

@@ -0,0 +1,24 @@
import importlib.util
import unittest
from pathlib import Path
def _load_adapter(name: str):
path = Path(__file__).with_name(name)
spec = importlib.util.spec_from_file_location(path.stem, path)
module = importlib.util.module_from_spec(spec)
assert spec and spec.loader
spec.loader.exec_module(module)
return module
class DemoTaskSelectionTest(unittest.TestCase):
def test_train_task_number_parsing_and_selection(self):
adapter = _load_adapter("train_measurement_run.py")
self.assertEqual(adapter._task_no_from_name("任务46_车体横断面对角线差值"), "46")
self.assertEqual(adapter._selected_task_nos({"demoTaskNos": [2, 46, 2]}), {"2", "46"})
self.assertIsNone(adapter._selected_task_nos({}))
if __name__ == "__main__":
unittest.main()