JOJ3-config-generator/tests/convert_joj1/utils.py
张泊明518370910136 30fae62b67
All checks were successful
build / build (pull_request) Successful in 2m38s
build / build (push) Successful in 2m41s
test: use load.py for joj1
2025-03-04 21:53:56 -05:00

20 lines
618 B
Python

from pathlib import Path
import rtoml
from joj3_config_generator.convert import convert_joj1
from joj3_config_generator.load import load_joj1_yaml
def load_case(case_name: str) -> None:
root = Path(__file__).resolve().parent
task_yaml_path = root / case_name / "task.yaml"
task_yaml = load_joj1_yaml(task_yaml_path)
task_toml_path = root / case_name / "task.toml"
task_toml = task_toml_path.read_text()
expected_result = rtoml.loads(task_toml)
result = convert_joj1(task_yaml).model_dump(
mode="json", by_alias=True, exclude_none=True
)
assert result == expected_result