44 lines
953 B
Python
44 lines
953 B
Python
import pytest
|
|
from easydict import EasyDict as edict
|
|
import modyml
|
|
|
|
|
|
@pytest.fixture
|
|
def _exp_mods_ctx():
|
|
_exp, mods, ctx = modyml.load(
|
|
"experiments/E01.yml",
|
|
module_files=["modules/optimizers.yml"],
|
|
base_dir="tests/fixture",
|
|
return_context=True,
|
|
)
|
|
return _exp, mods, ctx
|
|
|
|
|
|
@pytest.fixture
|
|
def exp():
|
|
return modyml.load(
|
|
"experiments/E01.yml",
|
|
module_files=["modules/optimizers.yml"],
|
|
base_dir="tests/fixture",
|
|
)
|
|
|
|
|
|
def test_resolve_name(exp):
|
|
assert exp.training.optimizer.type == "Adam"
|
|
|
|
|
|
def test_resolve_function(exp):
|
|
assert exp.training.optimizer2.params.learning_rate == 0.2
|
|
|
|
|
|
def test_resolve_inheritance(exp):
|
|
assert exp.training.optimizer3.params.learning_rate == 0.3
|
|
|
|
|
|
def test_misc(_exp_mods_ctx):
|
|
_exp, mods, ctx = _exp_mods_ctx
|
|
|
|
from rich.pretty import pprint as rich_pprint
|
|
rich_pprint(ctx)
|
|
rich_pprint(mods)
|
|
rich_pprint(_exp) |