def test_dict_round_trip(parmset_ae, parm_a, parm_b, parm_c, parm_e): parmset_ae.set_adjacent(parm_a, parm_c, False) parmset_ae.set_adjacent(parm_b, parm_e, False) parmset_dict = parmset_ae.to_dict() ps_new = ParameterSet.from_dict(parmset_dict) assert ps_new == parmset_ae
def test_from_dict(parmset_ae, parm_a, parm_b, parm_c, parm_d, parm_e): parmset_dict = { "uid": "337f7234-85a1-45a0-be77-0934ec232f21", "parameters": [p.to_dict() for p in [parm_a, parm_b, parm_c, parm_d, parm_e]], 'adjacency': [[True, True, False, True, True], [True, True, True, True, False], [False, True, True, True, True], [True, True, True, True, True], [True, False, True, True, True]] } ps = ParameterSet.from_dict(parmset_dict) expected_ps = ParameterSet([parm_a, parm_b, parm_c, parm_d, parm_e], uid="337f7234-85a1-45a0-be77-0934ec232f21") expected_ps.set_adjacent(parm_a, parm_c, False) expected_ps.set_adjacent(parm_b, parm_e, False) assert ps == expected_ps