MCPcopy Index your code
hub / github.com/RustPython/RustPython / assertClose

Method assertClose

Lib/test/test_complex.py:87–90  ·  view source on GitHub ↗

Return true iff complexes x and y "are close".

(self, x, y, eps=1e-9)

Source from the content-addressed store, hash-verified

85 self.assertTrue(abs((x-y)/y) < eps)
86
87 def assertClose(self, x, y, eps=1e-9):
88 """Return true iff complexes x and y "are close"."""
89 self.assertCloseAbs(x.real, y.real, eps)
90 self.assertCloseAbs(x.imag, y.imag, eps)
91
92 def check_div(self, x, y):
93 """Compute complex z=x*y, and check that z/x==y and z/y==x."""

Callers 2

check_divMethod · 0.95
test_conjugateMethod · 0.95

Calls 1

assertCloseAbsMethod · 0.95

Tested by

no test coverage detected