| Linux server27.hostingraja.org 2.6.32-954.3.5.lve1.4.93.el6.x86_64 #1 SMP Wed Oct 4 17:04:29 UTC 2023 x86_64 Path : /usr/lib64/python2.6/site-packages/numpy/core/tests/ |
| Current File : //usr/lib64/python2.6/site-packages/numpy/core/tests/test_machar.py |
from numpy.testing import *
from numpy.core.machar import MachAr
import numpy.core.numerictypes as ntypes
from numpy import seterr, array
class TestMachAr(TestCase):
def _run_machar_highprec(self):
# Instanciate MachAr instance with high enough precision to cause
# underflow
try:
hiprec = ntypes.float96
machar = MachAr(lambda v:array([v], hiprec))
except AttributeError:
"Skipping test: no nyptes.float96 available on this platform."
def test_underlow(self):
"""Regression testing for #759: instanciating MachAr for dtype =
np.float96 raises spurious warning."""
serrstate = seterr(all='raise')
try:
try:
self._run_machar_highprec()
except FloatingPointError, e:
self.fail("Caught %s exception, should not have been raised." % e)
finally:
seterr(**serrstate)
if __name__ == "__main__":
run_module_suite()