Lines Matching refs:got
106 def ulp_abs_check(expected, got, ulp_tol, abs_tol):
107 """Given finite floats `expected` and `got`, check that they're
113 ulp_error = abs(to_ulps(expected) - to_ulps(got))
114 abs_error = abs(expected - got)
174 def result_check(expected, got, ulp_tol=5, abs_tol=0.0):
176 """Compare arguments expected and got, as floats, if either
188 if got == expected:
194 if isinstance(expected, float) and isinstance(got, int):
195 got = float(got)
196 elif isinstance(got, float) and isinstance(expected, int):
199 if isinstance(expected, float) and isinstance(got, float):
200 if math.isnan(expected) and math.isnan(got):
203 elif math.isinf(expected) or math.isinf(got):
208 failure = ulp_abs_check(expected, got, ulp_tol, abs_tol)
212 fail_fmt = "expected {!r}, got {!r}"
213 fail_msg = fail_fmt.format(expected, got)
239 def ftest(self, name, got, expected, ulp_tol=5, abs_tol=0.0):
240 """Compare arguments expected and got, as floats, if either
248 failure = result_check(expected, got, ulp_tol, abs_tol)
696 self.fail("test %d failed: got OverflowError, expected %r "
699 self.fail("test %d failed: got ValueError, expected %r "
1651 # we've got an fp format with huge dynamic range
1748 got = func(arg)
1750 got = 'ValueError'
1752 got = 'OverflowError'
1790 failure = result_check(expected, got, ulp_tol, abs_tol)
2116 self.fail("Expected a NaN, got {!r}.".format(value))