Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)