|
Server : Apache System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64 User : njnconst ( 1116) PHP Version : 8.4.18 Disable Function : NONE Directory : /proc/self/root/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/tests/ |
Upload File : |
from __future__ import division, absolute_import, print_function
from numpy.core.machar import MachAr
import numpy.core.numerictypes as ntypes
from numpy import errstate, array
from numpy.testing import TestCase, run_module_suite
class TestMachAr(TestCase):
def _run_machar_highprec(self):
# Instantiate MachAr instance with high enough precision to cause
# underflow
try:
hiprec = ntypes.float96
MachAr(lambda v:array([v], hiprec))
except AttributeError:
"Skipping test: no ntypes.float96 available on this platform."
def test_underlow(self):
# Regression test for #759:
# instanciating MachAr for dtype = np.float96 raises spurious warning.
with errstate(all='raise'):
try:
self._run_machar_highprec()
except FloatingPointError as e:
self.fail("Caught %s exception, should not have been raised." % e)
if __name__ == "__main__":
run_module_suite()