Пример #1
0
def test_instantiate_bad_adam_conf() -> None:
    with pytest.raises(
            InstantiationException,
            match=
            "Missing _target_ value. Check that you specified it in 'BadAdamConf'"
            " and that the type annotation is correct: '_target_: str = ...'",
    ):
        utils.instantiate(BadAdamConf())
Пример #2
0
def test_instantiate_bad_adam_conf() -> None:
    msg = (
        "Missing value for BadAdamConf._target_. Check that it's properly annotated and overridden."
        "\nA common problem is forgetting to annotate _target_ as a string : '_target_: str = ...'"
    )
    with pytest.raises(
            InstantiationException,
            match=re.escape(msg),
    ):
        utils.instantiate(BadAdamConf())