Exemplo n.º 1
0
def test_cross():
    """test the cross product of two 3 dimentional vectors"""

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

    assert z == [-3, 6, -3]
Exemplo n.º 2
0
def test_mdim_cross():
    """test the cross product of two 4 dimentional 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)