Exemple #1
0
def test_dict_round_trip():
    p_orig = Parameter("Z", [VAL_1, VAL_2, VAL_3, VAL_4],
                       uid="337f7234-85a1-45a0-be77-0934ec232f21")

    parameter_dict = p_orig.to_dict()
    p_new = Parameter.from_dict(parameter_dict)

    assert p_new == p_orig
Exemple #2
0
def test_to_dict():
    p = Parameter("Z", [VAL_1, VAL_2, VAL_3, VAL_4],
                  uid="337f7234-85a1-45a0-be77-0934ec232f21")
    expected = {
        "name": "Z",
        "uid": "337f7234-85a1-45a0-be77-0934ec232f21",
        "values": [v.to_dict() for v in [VAL_1, VAL_2, VAL_3, VAL_4]],
    }
    assert p.to_dict() == expected