MCPcopy Index your code
hub / github.com/numpy/numpy / test_uniform_range_bounds

Method test_uniform_range_bounds

numpy/random/tests/test_random.py:975–989  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

973 assert_array_almost_equal(actual, desired, decimal=15)
974
975 def test_uniform_range_bounds(self):
976 fmin = np.finfo('float').min
977 fmax = np.finfo('float').max
978
979 func = np.random.uniform
980 assert_raises(OverflowError, func, -np.inf, 0)
981 assert_raises(OverflowError, func, 0, np.inf)
982 assert_raises(OverflowError, func, fmin, fmax)
983 assert_raises(OverflowError, func, [-np.inf], [0])
984 assert_raises(OverflowError, func, [0], [np.inf])
985
986 # (fmax / 1e17) - fmin is within range, so this should not throw
987 # account for i386 extended precision DBL_MAX / 1e17 + DBL_MAX >
988 # DBL_MAX by increasing fmin a bit
989 np.random.uniform(low=np.nextafter(fmin, 1), high=fmax / 1e17)
990
991 def test_scalar_exception_propagation(self):
992 # Tests that exceptions are correctly propagated in distributions

Callers

nothing calls this directly

Calls 2

assert_raisesFunction · 0.90
uniformMethod · 0.80

Tested by

no test coverage detected