MCPcopy Create free account
hub / github.com/MITK/MITK / _close

Function _close

Modules/Python/test/pytest/test_properties.py:25–33  ·  view source on GitHub ↗

Float (or float-sequence) comparison within tolerance. Used where float32 round-trip through mitk.Color loses precision relative to the double-precision Python input.

(a, b, tol=1e-6)

Source from the content-addressed store, hash-verified

23
24
25def _close(a, b, tol=1e-6):
26 """Float (or float-sequence) comparison within tolerance.
27
28 Used where float32 round-trip through mitk.Color loses precision
29 relative to the double-precision Python input.
30 """
31 if isinstance(a, (list, tuple)):
32 return len(a) == len(b) and all(abs(x - y) <= tol for x, y in zip(a, b))
33 return abs(a - b) <= tol
34
35
36class TestPropertyNotOwnedError:

Calls

no outgoing calls

Tested by

no test coverage detected