mirror of
https://github.com/python/cpython.git
synced 2025-11-02 14:41:33 +00:00
Merged revisions 74925 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r74925 | mark.dickinson | 2009-09-18 22:01:50 +0100 (Fri, 18 Sep 2009) | 2 lines Use skipUnless to skip math module tests on non-IEEE 754 platforms. ........
This commit is contained in:
parent
69b639f946
commit
63566239f7
1 changed files with 34 additions and 31 deletions
|
|
@ -13,6 +13,11 @@
|
||||||
INF = float('inf')
|
INF = float('inf')
|
||||||
NINF = float('-inf')
|
NINF = float('-inf')
|
||||||
|
|
||||||
|
# decorator for skipping tests on non-IEEE 754 platforms
|
||||||
|
requires_IEEE_754 = unittest.skipUnless(
|
||||||
|
float.__getformat__("double").startswith("IEEE"),
|
||||||
|
"test requires IEEE 754 doubles")
|
||||||
|
|
||||||
# detect evidence of double-rounding: fsum is not always correctly
|
# detect evidence of double-rounding: fsum is not always correctly
|
||||||
# rounded on machines that suffer from double rounding.
|
# rounded on machines that suffer from double rounding.
|
||||||
x, y = 1e16, 2.9999 # use temporary values to defeat peephole optimizer
|
x, y = 1e16, 2.9999 # use temporary values to defeat peephole optimizer
|
||||||
|
|
@ -209,7 +214,7 @@ class TestNoCeil:
|
||||||
self.assertRaises(TypeError, math.ceil, t)
|
self.assertRaises(TypeError, math.ceil, t)
|
||||||
self.assertRaises(TypeError, math.ceil, t, 0)
|
self.assertRaises(TypeError, math.ceil, t, 0)
|
||||||
|
|
||||||
if float.__getformat__("double").startswith("IEEE"):
|
@requires_IEEE_754
|
||||||
def testCopysign(self):
|
def testCopysign(self):
|
||||||
self.assertRaises(TypeError, math.copysign)
|
self.assertRaises(TypeError, math.copysign)
|
||||||
# copysign should let us distinguish signs of zeros
|
# copysign should let us distinguish signs of zeros
|
||||||
|
|
@ -364,8 +369,7 @@ def testfrexp(name, result, expected):
|
||||||
self.assertEquals(math.frexp(NINF)[0], NINF)
|
self.assertEquals(math.frexp(NINF)[0], NINF)
|
||||||
self.assertTrue(math.isnan(math.frexp(NAN)[0]))
|
self.assertTrue(math.isnan(math.frexp(NAN)[0]))
|
||||||
|
|
||||||
@unittest.skipUnless(float.__getformat__("double").startswith("IEEE"),
|
@requires_IEEE_754
|
||||||
"test requires IEEE 754 doubles")
|
|
||||||
@unittest.skipIf(HAVE_DOUBLE_ROUNDING,
|
@unittest.skipIf(HAVE_DOUBLE_ROUNDING,
|
||||||
"fsum is not exact on machines with double rounding")
|
"fsum is not exact on machines with double rounding")
|
||||||
def testFsum(self):
|
def testFsum(self):
|
||||||
|
|
@ -857,9 +861,8 @@ def test_exceptions(self):
|
||||||
else:
|
else:
|
||||||
self.fail("sqrt(-1) didn't raise ValueError")
|
self.fail("sqrt(-1) didn't raise ValueError")
|
||||||
|
|
||||||
|
@requires_IEEE_754
|
||||||
def test_testfile(self):
|
def test_testfile(self):
|
||||||
if not float.__getformat__("double").startswith("IEEE"):
|
|
||||||
return
|
|
||||||
for id, fn, ar, ai, er, ei, flags in parse_testfile(test_file):
|
for id, fn, ar, ai, er, ei, flags in parse_testfile(test_file):
|
||||||
# Skip if either the input or result is complex, or if
|
# Skip if either the input or result is complex, or if
|
||||||
# flags is nonempty
|
# flags is nonempty
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue