diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2010-12-04 12:42:18 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2010-12-04 12:42:18 (GMT) |
commit | 33154388f9f6b202fd513a98270a4607f20b47c0 (patch) | |
tree | 2d2c880b0996e92d14e248d85e0c4d762ddb1c06 /Lib/test/test_float.py | |
parent | 11e77ffcbc4a46001ba6c509f069692b4c5d0735 (diff) | |
download | cpython-33154388f9f6b202fd513a98270a4607f20b47c0.zip cpython-33154388f9f6b202fd513a98270a4607f20b47c0.tar.gz cpython-33154388f9f6b202fd513a98270a4607f20b47c0.tar.bz2 |
Backout broken backport. (Sorry.)
Diffstat (limited to 'Lib/test/test_float.py')
-rw-r--r-- | Lib/test/test_float.py | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py index 6d90637..b4897c9 100644 --- a/Lib/test/test_float.py +++ b/Lib/test/test_float.py @@ -12,6 +12,16 @@ import re INF = float("inf") NAN = float("nan") +have_getformat = hasattr(float, "__getformat__") +requires_getformat = unittest.skipUnless(have_getformat, + "requires __getformat__") +requires_setformat = unittest.skipUnless(hasattr(float, "__setformat__"), + "requires __setformat__") +# decorator for skipping tests on non-IEEE 754 platforms +requires_IEEE_754 = unittest.skipUnless(have_getformat and + float.__getformat__("double").startswith("IEEE"), + "test requires IEEE 754 doubles") + #locate file with float format test values test_dir = os.path.dirname(__file__) or os.curdir format_testfile = os.path.join(test_dir, 'formatfloat_testcases.txt') @@ -231,26 +241,6 @@ class GeneralFloatCases(unittest.TestCase): self.assertTrue(d == d, "{%r : None} not equal to itself" % f) - @requires_IEEE_754 - def test_float_mod(self): - # Check behaviour of % operator for IEEE 754 special cases. - # In particular, check signs of zeros. - mod = operator.mod - - self.assertEqualAndEqualSign(mod(-1.0, 1.0), 0.0) - self.assertEqualAndEqualSign(mod(-1e-100, 1.0), 1.0) - self.assertEqualAndEqualSign(mod(-0.0, 1.0), 0.0) - self.assertEqualAndEqualSign(mod(0.0, 1.0), 0.0) - self.assertEqualAndEqualSign(mod(1e-100, 1.0), 1e-100) - self.assertEqualAndEqualSign(mod(1.0, 1.0), 0.0) - - self.assertEqualAndEqualSign(mod(-1.0, -1.0), -0.0) - self.assertEqualAndEqualSign(mod(-1e-100, -1.0), -1e-100) - self.assertEqualAndEqualSign(mod(-0.0, -1.0), -0.0) - self.assertEqualAndEqualSign(mod(0.0, -1.0), -0.0) - self.assertEqualAndEqualSign(mod(1e-100, -1.0), -1.0) - self.assertEqualAndEqualSign(mod(1.0, -1.0), -0.0) - class FormatFunctionsTestCase(unittest.TestCase): |