コード例 #1
0
ファイル: test_tinynumpy.py プロジェクト: wadetb/tinynumpy
def test_4dim_dot():
    """test the dot product of two 4 dimensional vectors"""

    # 4 dim dot-product.
    x = [1, 2, 3, 4]
    y = [5, 6, 7, 8]
    z = tnp.dot(x, y)

    assert z == 70
コード例 #2
0
ファイル: test_tinynumpy.py プロジェクト: wadetb/tinynumpy
def test_dot():
    """test the dot product of two mixed dimensional vectors"""

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

    assert z == 32
コード例 #3
0
ファイル: test_tinynumpy.py プロジェクト: wadetb/tinynumpy
def test_2dim_dot():
    """test the dot product of two 2 dimensional vectors"""

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

    assert z == 14
コード例 #4
0
def test_4dim_dot():
    """test the dot product of two 4 dimensional vectors"""

    # 4 dim dot-product.
    x = [1, 2, 3, 4]
    y = [5, 6, 7, 8]
    z = tnp.dot(x, y)

    assert z == 70
コード例 #5
0
def test_2dim_dot():
    """test the dot product of two 2 dimensional vectors"""

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

    assert z == 14
コード例 #6
0
def test_dot():
    """test the dot product of two mixed dimensional vectors"""

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

    assert z == 32
コード例 #7
0
ファイル: test_tinynumpy.py プロジェクト: wadetb/tinynumpy
def test_mdim_dot():
    """test the dot product of two mixed dimensional vectors"""

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

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

    assert 'Vector has invalid dimensions' in str(execinfo.value)
コード例 #8
0
ファイル: test_tinynumpy.py プロジェクト: MacHu-GWU/tinynumpy
def test_4dim_dot():
    """test the dot product of two 4 dimentional vectors"""

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

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

    assert 'Vector has invalid dimensions' in str(execinfo.value)
コード例 #9
0
def test_mdim_dot():
    """test the dot product of two mixed dimensional vectors"""

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

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

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