Esempio n. 1
0
def test_setPosition_bad_pos_error():
    # Check if setPosition() is working as expected.
    startPos = [1, 2, 3.5]
    crashValue = [1, 2, 3, 4]

    with pytest.raises(SystemExit):
        rcs = base.RCS(startPos, 90, [0, 0, 1])
        rcs.setPosition(crashValue)
Esempio n. 2
0
def test_setOrientation_bad_axis_error():
    # Check if setPosition() is working as expected.
    startPos = [1, 2, 3.5]
    angle = 90
    badAxis = [1, 2, 3, 4]
    with pytest.raises(SystemExit):
        rcs = base.RCS(startPos, 90, [0, 0, 1])
        rcs.setOrientation(angle, badAxis)
Esempio n. 3
0
def test_setOrientation_bad_angle_error():
    # Check if setPosition() is working as expected.
    startPos = [1, 2, 3.5]
    badAngle = "string"
    axis = [1, 2, 3]
    with pytest.raises(SystemExit):
        rcs = base.RCS(startPos, 90, [0, 0, 1])
        rcs.setOrientation(badAngle, axis)
Esempio n. 4
0
def test_rotate_bad_axis_error2():
    # Check if setPosition() is working as expected.
    startPos = [1, 2, 3.5]
    invalidAxis = [0, 0, 1, 2]
    angle = 90
    with pytest.raises(SystemExit):
        rcs = base.RCS(startPos, 90, [0, 0, 1])
        rcs.rotate(angle, invalidAxis)
Esempio n. 5
0
def test_rotate_bad_anchor_error():
    # Check if setPosition() is working as expected.
    startPos = [1, 2, 3.5]
    axis = [0, 0, 1]
    angle = 90
    badAnchor = [0, 0, 0, 0]
    with pytest.raises(SystemExit):
        rcs = base.RCS(startPos, 90, [0, 0, 1])
        rcs.rotate(angle, axis, badAnchor)
Esempio n. 6
0
def test_setPosition():
    # Check if setPosition() is working as expected.
    errMsg = "Unexpected RCS position result for rotation"
    startPos = [1, 2, 3.5]
    expectedPos = [-4, 9.2, 0.0001]
    rcs = base.RCS(startPos, 90, [0, 0, 1])
    rcs.setPosition(expectedPos)
    rounding = 4
    assert all(round(rcs.position[i], rounding) ==
               expectedPos[i] for i in range(0, 3)), errMsg
Esempio n. 7
0
def test_move():
    # Check if move() is working as expected.
    errMsg_init = "Unexpected RCS position at initialization"
    errMsg_pos = "Unexpected RCS position result for translation"
    startPos = [1, 2, 3.5]
    expectedPos = [2, 4, 7]
    moveArg = [1, 2, 3.5]
    rcs = base.RCS(startPos, 90, [0, 0, 1])
    rounding = 4
    assert all(round(rcs.position[i], rounding) ==
               startPos[i] for i in range(0, 3)), errMsg_init
    rcs.move(moveArg)
    assert all(round(rcs.position[i], rounding) ==
               expectedPos[i] for i in range(0, 3)), errMsg_pos
Esempio n. 8
0
def test_setOrientation():
    # Check if setOrientation() is working as expected.
    errMsg_angle = "Unexpected RCS angle result for orientation"
    errMsg_axis = "Unexpected RCS axis result for orientation"
    startPos = [1, 2, 3.5]
    expectedAngle = 180
    expectedAxis = (0, 1, 0)

    angle = 180
    axis = (0, 1, 0)

    rcs = base.RCS(startPos, 90, [0, 0, 1])
    rcs.setOrientation(angle, axis)
    rounding = 4
    assert round(rcs.angle, rounding) == expectedAngle, errMsg_angle
    assert all(round(rcs.axis[i], rounding) == expectedAxis[i]
               for i in range(0, 3)), errMsg_axis
Esempio n. 9
0
def test_rotate():
    # Check if rotate() is working as expected WITH ANCHOR.
    errMsg_init = "Unexpected RCS position at initialization"
    errMsg_pos = "Unexpected RCS position result for rotation"
    errMsg_angle = "Unexpected RCS angle result for rotation"
    startPos = [1, 2, 3.5]
    expectedPos = [1,  2,  3.5]
    expectedAngle = 90
    angle = 90
    axis = (0, 0, 1)
    rcs = base.RCS(startPos, 90, axis)
    rounding = 4
    assert all(round(rcs.position[i], rounding) ==
               startPos[i] for i in range(0, 3)), errMsg_init
    rcs.rotate(angle, axis)
    assert all(round(rcs.position[i], rounding) ==
               expectedPos[i] for i in range(0, 3)), errMsg_pos
    assert round(expectedAngle, rounding) == angle, errMsg_angle
Esempio n. 10
0
def test_initialization_bad_axis_error():
    pos = [1, 23, 2]
    angle = 90
    badAxis = (1, 1, "str")
    with pytest.raises(AssertionError):
        base.RCS(pos, angle, badAxis)
Esempio n. 11
0
def test_initialization_bad_angle_error():
    pos = [23, 2, 20]
    badAngle = "string"
    axis = (1, 1)
    with pytest.raises(SystemExit):
        base.RCS(pos, badAngle, axis)
Esempio n. 12
0
def test_initialization_bad_pos_error():
    badPos = [23, 2]
    angle = 90
    axis = (1, 1, 1)
    with pytest.raises(SystemExit):
        base.RCS(badPos, angle, axis)
Esempio n. 13
0
def test_initialization_bad_axis_error3():
    pos = [23, 2, 20]
    angle = 90
    badAxis = (1, 1)
    with pytest.raises(SystemExit):
        base.RCS(pos, angle, badAxis)