Example #1
0
def test_init_two_parms():
    p1 = Parameter.create_with_unnamed_values("P1", 2)
    p2 = Parameter.create_with_unnamed_values("P2", 3)
    plist = [p1, p2]
    ps = ParameterSet(plist)

    assert len(ps.parameters) == 2
    assert ps.parameters == plist
    assert ps.parameters is not plist  # copy, not reference
Example #2
0
def test_create_different_size_parms():
    p1 = Parameter.create_with_unnamed_values("1", 4)
    p2 = Parameter.create_with_unnamed_values("2", 5)
    p3 = Parameter.create_with_unnamed_values("3", 3)
    plist = [p1, p2, p3]

    ps = ParameterSet(plist)

    assert ps.parameters == plist
Example #3
0
def test_init_three_parms():
    p1 = Parameter.create_with_unnamed_values("P1", 4)
    p2 = Parameter.create_with_unnamed_values("P2", 6)
    p3 = Parameter.create_with_unnamed_values("P3", 2)
    plist = [p1, p2, p3]

    ps = ParameterSet(plist)

    assert len(ps.parameters) == 3
    assert ps.parameters == plist
    assert ps.parameters is not plist  # copy, not reference
Example #4
0
def test_create_same_size_parms():
    ps = ParameterSet.create_from_parm_and_value_sizes(3, 4)

    p1 = Parameter.create_with_unnamed_values("1", 4)
    p2 = Parameter.create_with_unnamed_values("2", 4)
    p3 = Parameter.create_with_unnamed_values("3", 4)
    plist = [p1, p2, p3]
    ps_expected = ParameterSet(plist)

    assert all(
        pactual.name == pexpected.name
        for pactual, pexpected in zip(ps.parameters, ps_expected.parameters))
    assert all(
        len(pactual) == len(pexpected)
        for pactual, pexpected in zip(ps.parameters, ps_expected.parameters))
Example #5
0
def test_init_one_parm():
    p = Parameter.create_with_unnamed_values('Z', 4)

    plist = [
        p,
    ]
    ps = ParameterSet(plist)

    assert ps.parameters == plist
    assert ps.parameters is not plist  # copy, not reference
Example #6
0
def test_create_with_values():
    p = Parameter.create_with_unnamed_values("Z", 4)

    assert p.name == "Z"

    v1 = Value("1", uid=p.values[0].uid)
    v2 = Value("2", uid=p.values[1].uid)
    v3 = Value("3", uid=p.values[2].uid)
    v4 = Value("4", uid=p.values[3].uid)

    assert p.values == [v1, v2, v3, v4]
Example #7
0
def parm_2():
    return Parameter.create_with_unnamed_values("2", 3)
Example #8
0
def parm_7():
    return Parameter.create_with_unnamed_values("7", 2)
Example #9
0
def parm_6():
    return Parameter.create_with_unnamed_values("6", 5)
Example #10
0
def parm_4():
    return Parameter.create_with_unnamed_values("4", 4)