Author: Antonio Cuni <[email protected]>
Branch: int_w-refactor
Changeset: r69428:ce4d4ceb14e2
Date: 2014-02-24 11:50 +0100
http://bitbucket.org/pypy/pypy/changeset/ce4d4ceb14e2/

Log:    add a failing test which should pass at the end of this branch

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
@@ -7,7 +7,7 @@
 
 
 class AppTestStruct(object):
-    spaceconfig = dict(usemodules=['struct'])
+    spaceconfig = dict(usemodules=['struct', 'micronumpy'])
 
     def setup_class(cls):
         """
@@ -19,7 +19,7 @@
             return struct
         """)
         cls.w_native_is_bigendian = cls.space.wrap(native_is_bigendian)
-
+        cls.w_runappdirect = cls.space.wrap(cls.runappdirect)
 
     def test_error(self):
         """
@@ -384,6 +384,18 @@
         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)
+        data = self.struct.pack('d', obj)
+        obj2, = self.struct.unpack('d', data)
+        assert type(obj2) is float
+        assert obj2 == 42.3
+
 
 class AppTestStructBuffer(object):
     spaceconfig = dict(usemodules=['struct', '__pypy__'])
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to