예제 #1
0
def test_cpman_curve8():
    """ Control Points Manager: try to set invalid key """
    with pytest.raises(GeomdlException):
        d = [0.0, 1.0, 2.0, 3.0]
        p = 5
        sz = 12
        cpman = control_points.CurveManager(sz, testdata=4)
        cpman.set_ptdata({'testdata1': d}, p)
예제 #2
0
def test_cpman_curve6():
    """ Control Points Manager: get-set attachment (exception) """
    with pytest.raises(GeomdlException):
        d = [0.0, 1.0, 2.0, 3.0]
        p = 5
        sz = 12
        cpman = control_points.CurveManager(sz, testdata=3)
        cpman.set_ptdata(dict(testdata=d), p)
예제 #3
0
def test_cpman_curve7():
    """ Control Points Manager: get-set attachment (valid, float) """
    d = 13
    p = 5
    sz = 12
    cpman = control_points.CurveManager(sz, testdata=1)
    cpman.set_ptdata(dict(testdata=d), p)
    assert cpman.get_ptdata('testdata', 5) == 13
예제 #4
0
def test_cpman_curve1():
    """ Control Points Manager: get-set point (curve) """
    pt = [0.0, 0.2, 0.3]
    p = 3
    sz = 10
    cpman = control_points.CurveManager(sz)
    cpman.set_ctrlpt(pt, p)
    assert cpman.get_ctrlpt(3) == pt
예제 #5
0
def test_cpman_curve5():
    """ Control Points Manager: get-set attachment (invalid, list) """
    d = [0.0, 1.0, 2.0, 3.0]
    p = 5
    sz = 12
    cpman = control_points.CurveManager(sz, testdata=4)
    cpman.set_ptdata(dict(testdata=d), p)
    retv = cpman.get_ptdata('testdata2', p)
    assert retv == None
예제 #6
0
def test_cpman_curve4():
    """ Control Points Manager: get-set attachment (valid, list) """
    d = [0.0, 1.0, 2.0, 3.0]
    p = 5
    sz = 12
    cpman = control_points.CurveManager(sz, testdata=4)
    cpman.set_ptdata(dict(testdata=d), p)
    retv1 = cpman.get_ptdata('testdata', p)
    retv2 = cpman.get_ptdata('testdata', p + 1)
    assert retv1[2] == 2.0
    assert retv2[2] == 0.0
예제 #7
0
def test_cpman_curve3():
    """ Control Points Manager: check for invalid index """
    p = 12
    sz = 5
    cpman = control_points.CurveManager(sz)
    assert cpman.get_ctrlpt(p) == None
예제 #8
0
def test_cpman_curve2():
    """ Control Points Manager: get empty point (curve) """
    p = 5
    sz = 12
    cpman = control_points.CurveManager(sz)
    assert cpman.get_ctrlpt(p) == list()