def register_result(self, name, value): if os.path.exists(self.results_file): results = Config.from_json(self.results_file).as_flat_dict() else: results = dict() results[name] = value Config.from_flat_dict(results).to_json(self.results_file)
def test_config_from_flat_dict(): config = {"a.a": 10, "b": "b", "a.b": [1, 2, 3], "a.c.c": 1} config = Config.from_flat_dict(config) assert config.a.a == 10 assert config.b == "b" assert config.a.b == [1, 2, 3] assert config.a.c.c == 1