Esempio n. 1
0
 def test_repr(self,tmp_path):
     config = Config()
     config['A'] = 1
     config['B'] = [2,3]
     with open(tmp_path/'config.yaml','w') as f:
         f.write(config.__repr__())
     assert Config.load(tmp_path/'config.yaml') == config
Esempio n. 2
0
 def test_load_save_file(self,tmp_path):
     config = Config()
     config['A'] = 1
     config['B'] = [2,3]
     with open(tmp_path/'config.yaml','w') as f:
         config.save(f)
     with open(tmp_path/'config.yaml') as f:
         assert Config.load(f) == config
Esempio n. 3
0
 def test_load_save_str(self,tmp_path,flow_style):
     config = Config()
     config['A'] = 1
     config['B'] = [2,3]
     config.save(tmp_path/'config.yaml',default_flow_style=flow_style)
     assert Config.load(tmp_path/'config.yaml') == config