Exemple #1
0
def test_vector3_normalize():
    vec = (5, 2.5, 5)
    result = [0.667, 0.333, 0.667]
    to_check = linalg.vector_normalize(vec, decimals=3)
    assert to_check == result
Exemple #2
0
def test_vector_normalize2():
    with pytest.raises(ValueError):
        vec = (0, 0)
        linalg.vector_normalize(vec)
Exemple #3
0
def test_vector_normalize3():
    with pytest.raises(TypeError):
        linalg.vector_normalize(5)
Exemple #4
0
def test_vector4_normalize():
    vec = (5, 2.5, 5, 10)
    result = [0.4, 0.2, 0.4, 0.8]
    to_check = linalg.vector_normalize(vec)
    assert to_check == result
Exemple #5
0
def test_vector3_normalize():
    vec = (5, 2.5, 5)
    result = [0.667, 0.333, 0.667]
    to_check = linalg.vector_normalize(vec, decimals=3)
    assert to_check == result
Exemple #6
0
def test_vector_normalize3():
    with pytest.raises(TypeError):
        linalg.vector_normalize(5)
Exemple #7
0
def test_vector_normalize2():
    with pytest.raises(ValueError):
        vec = (0, 0)
        linalg.vector_normalize(vec)
Exemple #8
0
def test_vector4_normalize():
    vec = (5, 2.5, 5, 10)
    result = [0.4, 0.2, 0.4, 0.8]
    to_check = linalg.vector_normalize(vec)
    assert to_check == result