31 lines
1,016 B
Python
31 lines
1,016 B
Python
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
import tempfile
|
||
|
|
import unittest
|
||
|
|
from pathlib import Path
|
||
|
|
|
||
|
|
from airfrans_frontier.training.config import load_training_config
|
||
|
|
|
||
|
|
|
||
|
|
class TrainingConfigTests(unittest.TestCase):
|
||
|
|
def test_config_loader_accepts_mlp_tiny(self) -> None:
|
||
|
|
config = load_training_config("configs/mlp_tiny.toml")
|
||
|
|
|
||
|
|
self.assertEqual(config.run.name, "mlp_tiny")
|
||
|
|
self.assertEqual(config.model.type, "mlp")
|
||
|
|
self.assertEqual(config.loss.type, "normalized_mse")
|
||
|
|
self.assertEqual(config.device.type, "cuda")
|
||
|
|
self.assertTrue(config.data.root.is_absolute())
|
||
|
|
|
||
|
|
def test_config_loader_rejects_missing_section(self) -> None:
|
||
|
|
with tempfile.TemporaryDirectory() as tmp:
|
||
|
|
config_path = Path(tmp) / "bad.toml"
|
||
|
|
config_path.write_text("[run]\nname = 'bad'\n")
|
||
|
|
|
||
|
|
with self.assertRaisesRegex(ValueError, r"missing \[data\] section"):
|
||
|
|
load_training_config(config_path)
|
||
|
|
|
||
|
|
|
||
|
|
if __name__ == "__main__":
|
||
|
|
unittest.main()
|