[pypy-svn] pypy default: (fijal, arigo)

arigo commits-noreply at bitbucket.org
Thu Jan 20 15:22:06 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r41033:ac00573755d7
Date: 2011-01-20 15:17 +0100
http://bitbucket.org/pypy/pypy/changeset/ac00573755d7/

Log:	(fijal, arigo)

	Skip this test on 2.5. Limitation of struct.pack().

diff --git a/pypy/rlib/rstruct/test/test_ieee.py b/pypy/rlib/rstruct/test/test_ieee.py
--- a/pypy/rlib/rstruct/test/test_ieee.py
+++ b/pypy/rlib/rstruct/test/test_ieee.py
@@ -1,3 +1,4 @@
+import py, sys
 import random
 import struct
 
@@ -7,6 +8,10 @@
 
 class TestFloatPacking:
 
+    def setup_class(cls):
+        if sys.version_info < (2, 6):
+            py.test.skip("the 'struct' module of this old CPython is broken")
+
     def check_float(self, x):
         # check roundtrip
         Q = float_pack(x, 8)
@@ -43,8 +48,12 @@
         self.check_float(-0.0)
 
     def test_nans(self):
-        self.check_float(float('nan'))
-        self.check_float(float('-nan'))
+        Q = float_pack(float('nan'), 8)
+        y = float_unpack(Q, 8)
+        assert repr(y) == 'nan'
+        L = float_pack(float('nan'), 4)
+        z = float_unpack(L, 4)
+        assert repr(z) == 'nan'
 
     def test_simple(self):
         test_values = [1e-10, 0.00123, 0.5, 0.7, 1.0, 123.456, 1e10]


More information about the Pypy-commit mailing list