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]
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]
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)