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

Method test_uniform_range_bounds

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

Source from the content-addressed store, hash-verified

967 assert_array_almost_equal(actual, desired, decimal=15)
968
969 def test_uniform_range_bounds(self):
970 fmin = np.finfo('float').min
971 fmax = np.finfo('float').max
972
973 func = np.random.uniform
974 assert_raises(OverflowError, func, -np.inf, 0)
975 assert_raises(OverflowError, func, 0, np.inf)
976 assert_raises(OverflowError, func, fmin, fmax)
977 assert_raises(OverflowError, func, [-np.inf], [0])
978 assert_raises(OverflowError, func, [0], [np.inf])
979
980 # (fmax / 1e17) - fmin is within range, so this should not throw
981 # account for i386 extended precision DBL_MAX / 1e17 + DBL_MAX >
982 # DBL_MAX by increasing fmin a bit
983 np.random.uniform(low=np.nextafter(fmin, 1), high=fmax / 1e17)
984
985 def test_scalar_exception_propagation(self):
986 # 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