def test_dictconfig(): conf = DictConfig( {"TEST": "value", "PREFIX_ONE": "foo", "PREFIX_TWO": "bar"} ) assert conf.get("FOO") is NOT_PROVIDED assert dict(conf.iterprefixed("NOPREFIX_")) == {} assert conf.get("TEST") == "value" assert dict(conf.iterprefixed("PREFIX_")) == { "PREFIX_ONE": "foo", "PREFIX_TWO": "bar", }
def test_dictconfig(): conf = DictConfig({ "TEST": "value", "PREFIX_ONE": "foo", "PREFIX_TWO": "bar" }) assert conf.get("FOO") is NOT_PROVIDED assert dict(conf.iterprefixed("NOPREFIX_")) == {} assert conf.get("TEST") == "value" assert dict(conf.iterprefixed("PREFIX_")) == { "PREFIX_ONE": "foo", "PREFIX_TWO": "bar", }
def test_dict_iter_config(): conf = DictConfig( { "TEST_KEY_1": 1, "TEST_KEY_2": 2, "TEST_FOO_3": 3, "TEST_KEX_1": 1, "TEST_KEY_3": 3, "TEST_BAR_1": 1, }, prefix="TEST_", ) items = conf.iterprefixed("KEY_") assert sorted(items) == [("KEY_1", 1), ("KEY_2", 2), ("KEY_3", 3)]