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

Method test_floating_overflow

numpy/core/tests/test_scalar_ctors.py:21–39  ·  view source on GitHub ↗

Strings containing an unrepresentable float overflow

(self)

Source from the content-addressed store, hash-verified

19 assert_almost_equal(flongdouble, 1.234)
20
21 def test_floating_overflow(self):
22 """ Strings containing an unrepresentable float overflow """
23 fhalf = np.half('1e10000')
24 assert_equal(fhalf, np.inf)
25 fsingle = np.single('1e10000')
26 assert_equal(fsingle, np.inf)
27 fdouble = np.double('1e10000')
28 assert_equal(fdouble, np.inf)
29 flongdouble = assert_warns(RuntimeWarning, np.longdouble, '1e10000')
30 assert_equal(flongdouble, np.inf)
31
32 fhalf = np.half('-1e10000')
33 assert_equal(fhalf, -np.inf)
34 fsingle = np.single('-1e10000')
35 assert_equal(fsingle, -np.inf)
36 fdouble = np.double('-1e10000')
37 assert_equal(fdouble, -np.inf)
38 flongdouble = assert_warns(RuntimeWarning, np.longdouble, '-1e10000')
39 assert_equal(flongdouble, -np.inf)
40
41
42class TestExtraArgs:

Callers

nothing calls this directly

Calls 3

assert_equalFunction · 0.90
assert_warnsFunction · 0.90
doubleMethod · 0.80

Tested by

no test coverage detected