Author: Antonio Cuni <anto.c...@gmail.com>
Branch: int_w-refactor
Changeset: r69503:801dcc30809e
Date: 2014-02-27 10:27 +0100
http://bitbucket.org/pypy/pypy/changeset/801dcc30809e/

Log:    change the test to use a more explicit object with __float__ instead
        of numpy's floats

diff --git a/pypy/module/struct/test/test_struct.py 
b/pypy/module/struct/test/test_struct.py
--- a/pypy/module/struct/test/test_struct.py
+++ b/pypy/module/struct/test/test_struct.py
@@ -384,13 +384,14 @@
         assert self.struct.unpack("ii", b) == (62, 12)
         raises(self.struct.error, self.struct.unpack, "i", b)
 
-    def test_numpy_dtypes(self):
-        if self.runappdirect:
-            from numpy.core.multiarray import typeinfo
-        else:
-            from _numpypy.multiarray import typeinfo
-        float64 = typeinfo['DOUBLE'][4]
-        obj = float64(42.3)
+    def test___float__(self):
+        class MyFloat(object):
+            def __init__(self, x):
+                self.x = x
+            def __float__(self):
+                return self.x
+
+        obj = MyFloat(42.3)
         data = self.struct.pack('d', obj)
         obj2, = self.struct.unpack('d', data)
         assert type(obj2) is float
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to