Exemple #1
0
def test_checkDimensionZero():
    # errMsg = "Did not raise all zeros Error"
    with pytest.raises(AssertionError):
        checkDimensions(3, dim=(.0, 0, .0))

    with pytest.raises(AssertionError):
        checkDimensions(0, dim=[])
Exemple #2
0
def test_checkDimensionReturn():
    errMsg = "Wrong return dimension size"
    result = checkDimensions(4, dim=(3, 5, 9, 10))
    assert len(result) == 4, errMsg
    result = checkDimensions(3, dim=(3, 5, 9))
    assert len(result) == 3, errMsg
    result = checkDimensions(2, dim=(3, 5))
    assert len(result) == 2, errMsg
    result = checkDimensions(1, dim=(3))
    assert len(result) == 1, errMsg
Exemple #3
0
    def __init__(self, moment=(Mx, My, Mz),
                 pos=(0.0, 0.0, 0.0),
                 angle=0.0, axis=(0.0, 0.0, 1.0)):

        # inherit class RCS
        RCS.__init__(self, pos, angle, axis)

        # secure input type and check input format of moment
        self.moment = checkDimensions(3, moment, "Bad moment input")
Exemple #4
0
    def __init__(self,
                 mag=(Mx, My, Mz),
                 dim=(a, b, c),
                 pos=(0.0, 0.0, 0.0),
                 angle=0.0,
                 axis=(0.0, 0.0, 1.0)):
        # inherit class HomoMag
        HomoMag.__init__(self, pos, angle, axis, mag)

        # secure input type and check input format of dim
        self.dimension = checkDimensions(3, dim, "Bad dim for box")
Exemple #5
0
    def __init__(self, mag=(Mx, My, Mz), dim=(d, h), pos=(0.0, 0.0, 0.0), angle=0.0, axis=(0.0, 0.0, 1.0), iterDia=50):

        # inherit class homoMag
        #   - pos, Mrot, MrotInv, mag
        #   - moveBy, rotateBy
        HomoMag.__init__(self, pos, angle, axis, mag)

        # secure input type and check input format of dim
        assert type(
            iterDia) == int, 'Bad iterDia input for cylinder, expected <class int> got ' + str(type(iterDia))
        self.dimension = checkDimensions(2, dim, "Bad dim input for cylinder")
        self.iterDia = iterDia
Exemple #6
0
def test_checkDimensionSize():
    errMsg = "Did not raise wrong dimension size Error"
    with pytest.raises(AssertionError) as error:
        checkDimensions(3, dim=(3, 5, 9, 6))
    assert error.type == AssertionError, errMsg
Exemple #7
0
def test_checkDimensionMembers():
    # errMsg = "Did not raise expected Value Error"
    with pytest.raises(ValueError):
        checkDimensions(3, dim=(3, 'r', 6))