MCPcopy Index your code
hub / github.com/python/cpython / ftest

Method ftest

Lib/test/test_math.py:214–225  ·  view source on GitHub ↗

Compare arguments expected and got, as floats, if either is a float, using a tolerance expressed in multiples of ulp(expected) or absolutely, whichever is greater. As a convenience, when neither argument is a float, and for non-finite floats, exact equality is demand

(self, name, got, expected, ulp_tol=5, abs_tol=0.0)

Source from the content-addressed store, hash-verified

212class MathTests(unittest.TestCase):
213
214 def ftest(self, name, got, expected, ulp_tol=5, abs_tol=0.0):
215 """Compare arguments expected and got, as floats, if either
216 is a float, using a tolerance expressed in multiples of
217 ulp(expected) or absolutely, whichever is greater.
218
219 As a convenience, when neither argument is a float, and for
220 non-finite floats, exact equality is demanded. Also, nan==nan
221 in this function.
222 """
223 failure = result_check(expected, got, ulp_tol, abs_tol)
224 if failure is not None:
225 self.fail("{}: {}".format(name, failure))
226
227 def testConstants(self):
228 # Ref: Abramowitz & Stegun (Dover, 1965)

Callers 15

testConstantsMethod · 0.95
testAcosMethod · 0.95
testAcoshMethod · 0.95
testAsinMethod · 0.95
testAsinhMethod · 0.95
testAtanMethod · 0.95
testAtanhMethod · 0.95
testAtan2Method · 0.95
testCbrtMethod · 0.95
testCosMethod · 0.95
testCoshMethod · 0.95
testDegreesMethod · 0.95

Calls 3

result_checkFunction · 0.85
failMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected