示例#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
示例#2
0
def test_vector_normalize2():
    with pytest.raises(ValueError):
        vec = (0, 0)
        linalg.vector_normalize(vec)
示例#3
0
def test_vector_normalize3():
    with pytest.raises(TypeError):
        linalg.vector_normalize(5)
示例#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
示例#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
示例#6
0
def test_vector_normalize3():
    with pytest.raises(TypeError):
        linalg.vector_normalize(5)
示例#7
0
def test_vector_normalize2():
    with pytest.raises(ValueError):
        vec = (0, 0)
        linalg.vector_normalize(vec)
示例#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