コード例 #1
0
ファイル: test_tinynumpy.py プロジェクト: wadetb/tinynumpy
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]
コード例 #2
0
ファイル: test_tinynumpy.py プロジェクト: wadetb/tinynumpy
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]
コード例 #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]
コード例 #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]
コード例 #5
0
ファイル: test_tinynumpy.py プロジェクト: wadetb/tinynumpy
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)
コード例 #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)