Exemplo n.º 1
0
def test_2dim_cross():
    """test the cross product of two 2 dimensional vectors"""

    # 2 dim cross-product.
    x = [1, 2]
    y = [4, 5]
    z = tnp.cross(x, y)

    assert z == [-3]
Exemplo n.º 2
0
def test_cross():
    """test the cross product of two 3 dimensional vectors"""

    # Vector cross-product.
    x = [1, 2, 3]
    y = [4, 5, 6]
    z = tnp.cross(x, y)

    assert z == [-3, 6, -3]
Exemplo n.º 3
0
def test_2dim_cross():
    """test the cross product of two 2 dimensional vectors"""

    # 2 dim cross-product.
    x = [1, 2]
    y = [4, 5]
    z = tnp.cross(x, y)

    assert z == [-3]
Exemplo n.º 4
0
def test_cross():
    """test the cross product of two 3 dimensional vectors"""

    # Vector cross-product.
    x = [1, 2, 3]
    y = [4, 5, 6]
    z = tnp.cross(x, y)

    assert z == [-3, 6, -3]
Exemplo n.º 5
0
def test_mdim_cross():
    """test the cross product of two 4 dimensional vectors"""

    # Mixed dim cross-product.
    x = [1, 2, 3]
    y = [4, 5, 6, 7]

    with pytest.raises(IndexError) as execinfo:
        z = tnp.cross(x, y)

    assert 'Vector has invalid dimensions' in str(execinfo.value)
Exemplo n.º 6
0
def test_mdim_cross():
    """test the cross product of two 4 dimensional vectors"""

    # Mixed dim cross-product.
    x = [1, 2, 3]
    y = [4, 5, 6, 7]

    with pytest.raises(IndexError) as execinfo:
        z = tnp.cross(x, y)

    assert 'Vector has invalid dimensions' in str(execinfo.value)