def test_save_write(): test_file = 'conf2.json' conf = config.Config() c = conf.load('conf.json', validate_config=True) conf.save(test_file, overwrite=True) c = conf.load(test_file, validate_config=True) conf.save(test_file, overwrite=True) os.remove(test_file)
def test_conf_build_validate(): with open('conf.json') as conf_file: conf = json.load(conf_file) conf = config.Config(conf) assert conf['name'] == "test" assert conf['train']['batch_size'] == 128
def test_conf_object_build_validate(): with open('conf.json') as conf_file: conf = json.load(conf_file) conf = config.Config(conf) c = conf.build(validate_config=True) assert c.name == "test" assert c.description == "Some text" assert c.train['batch_size'] == 128
def test_save_no_overwrite(): with pytest.raises(FileExistsError) as e_info: conf = config.Config() c = conf.load('conf.json', validate_config=True) conf.save('conf.json')
def test_expand(): conf = config.Config() c = conf.load('conf.json', validate_config=True) print(*c)
def test_load_config_file(): conf = config.Config() c = conf.load('conf.json', validate_config=True) assert c.name == "test" assert c.description == "Some text" assert c.train['batch_size'] == 128