Example #1
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
Example #2
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
Example #3
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
Example #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
Example #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
Example #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
Example #7
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)
Example #8
0
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)
Example #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)