MCPcopy Create free account
hub / github.com/numpy/numpy / do_precision_upper_bound

Method do_precision_upper_bound

numpy/lib/tests/test_histograms.py:357–372  ·  view source on GitHub ↗
(self, float_small, float_large)

Source from the content-addressed store, hash-verified

355 assert_equal(x_loc.dtype, float_small)
356
357 def do_precision_upper_bound(self, float_small, float_large):
358 eps = np.finfo(float_large).eps
359
360 arr = np.array([1.0], float_small)
361 range = np.array([0.0, 1.0 - eps], float_large)
362
363 # test is looking for behavior when the bounds change between dtypes
364 if range.astype(float_small)[-1] != 1:
365 return
366
367 # previously crashed
368 count, x_loc = np.histogram(arr, bins=1, range=range)
369 assert_equal(count, [1])
370
371 # gh-10322 means that the type comes from arr - this may change
372 assert_equal(x_loc.dtype, float_small)
373
374 def do_precision(self, float_small, float_large):
375 self.do_precision_lower_bound(float_small, float_large)

Callers 1

do_precisionMethod · 0.95

Calls 2

assert_equalFunction · 0.90
astypeMethod · 0.80

Tested by

no test coverage detected