MCPcopy Index your code
hub / github.com/TheAlgorithms/Python / test_euclidean_length

Method test_euclidean_length

linear_algebra/src/test_linear_algebra.py:48–59  ·  view source on GitHub ↗

test for method euclidean_length()

(self)

Source from the content-addressed store, hash-verified

46 assert len(x) == 4
47
48 def test_euclidean_length(self) -> None:
49 """
50 test for method euclidean_length()
51 """
52 x = Vector([1, 2])
53 y = Vector([1, 2, 3, 4, 5])
54 z = Vector([0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
55 w = Vector([1, -1, 1, -1, 2, -3, 4, -5])
56 assert x.euclidean_length() == pytest.approx(2.236, abs=1e-3)
57 assert y.euclidean_length() == pytest.approx(7.416, abs=1e-3)
58 assert z.euclidean_length() == 0
59 assert w.euclidean_length() == pytest.approx(7.616, abs=1e-3)
60
61 def test_add(self) -> None:
62 """

Callers

nothing calls this directly

Calls 2

euclidean_lengthMethod · 0.95
VectorClass · 0.85

Tested by

no test coverage detected