feat: add pyyaml

This commit is contained in:
张泊明518370910136 2024-10-21 07:25:51 -04:00
parent 75bb6d6667
commit 078ebd8147
GPG Key ID: D47306D7062CDA9D
3 changed files with 4 additions and 3 deletions

View File

@ -5,7 +5,7 @@
groups = ["default", "dev", "lint", "test"]
strategy = ["inherit_metadata"]
lock_version = "4.5.0"
content_hash = "sha256:6757968c6c0d6bac2715cd137f74ac1d5696aae59c2079afe788c8338716646a"
content_hash = "sha256:d0c5550bb08b549f50b06136edcc32fe9607d8e59a05d891949095633ef4a83e"
[[metadata.targets]]
requires_python = ">=3.10"

View File

@ -6,7 +6,7 @@ build-backend = "pdm.backend"
name = "JOJ3-config-generator"
version = "0.1.0"
dependencies = [
"PyYAML>=6.0.2",
"pyyaml>=6.0.2",
"typer>=0.12.5",
"loguru>=0.7.2",
"pydantic>=2.9.2",

View File

@ -4,6 +4,7 @@ from typing import Any, Dict, List, Tuple
import pytest
import rtoml
import yaml
from joj3_config_generator.models import JOJ1Config, TaskConfig
from tests.utils import safe_id
@ -19,7 +20,7 @@ def read_convert_joj1_files(root: str) -> Tuple[JOJ1Config, TaskConfig, Dict[str
task_toml = task_file.read()
with open(expected_json_path) as result_file:
expected_result: Dict[str, Any] = json.load(result_file)
joj1_obj = rtoml.loads(task_yaml)
joj1_obj = yaml.safe_load(task_yaml)
task_obj = rtoml.loads(task_toml)
return JOJ1Config(**joj1_obj), TaskConfig(**task_obj), expected_result