Пример #1
0
def save_load__from_filename(conf):
    # note that delete=False here is a work around windows incompetence.
    try:
        with tempfile.NamedTemporaryFile(delete=False) as fp:
            conf.save(fp.name)
            c2 = OmegaConf.from_filename(fp.name)
            assert conf == c2
    finally:
        os.unlink(fp.name)
Пример #2
0
def test_from_filename():
    # note that delete=False here is a work around windows incompetence.
    try:
        with tempfile.NamedTemporaryFile(delete=False) as fp:
            s = b'a: b'
            fp.write(s)
            fp.flush()
            c = OmegaConf.from_filename(fp.name)
            assert {'a': 'b'} == c
    finally:
        os.unlink(fp.name)