def test_loadback(self): tp = TrainingParam() tmp_dir = tempfile.mkdtemp() tp.save_as_json(tmp_dir, "test.json") tp2 = TrainingParam.from_json(os.path.join(tmp_dir, "test.json")) assert tp2 == tp
def _aux_test_attr(self, attr, val): """ test that i can modify an attribut and then load the training parameters the correct way """ tp = TrainingParam() setattr(tp, attr, val) tmp_dir = tempfile.mkdtemp() tp.save_as_json(tmp_dir, "test.json") tp2 = TrainingParam.from_json(os.path.join(tmp_dir, "test.json")) assert tp2 == tp, "error for attributes {}".format(attr)