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