Author: Brian Kearns <[email protected]>
Branch: 
Changeset: r67385:0b3416c0ca57
Date: 2013-10-15 04:33 -0400
http://bitbucket.org/pypy/pypy/changeset/0b3416c0ca57/

Log:    test/fix CFLOAT/CDOUBLE typeinfo

diff --git a/pypy/module/micronumpy/interp_dtype.py 
b/pypy/module/micronumpy/interp_dtype.py
--- a/pypy/module/micronumpy/interp_dtype.py
+++ b/pypy/module/micronumpy/interp_dtype.py
@@ -816,14 +816,14 @@
             #'OBJECT',
             'ULONGLONG': self.w_uint64dtype,
             'STRING': self.w_stringdtype,
-            'CDOUBLE': self.w_complex64dtype,
+            'CFLOAT': self.w_complex64dtype,
+            'CDOUBLE': self.w_complex128dtype,
             #'DATETIME',
             'UINT': self.w_uint32dtype,
             'INTP': self.w_intpdtype,
             'UINTP': self.w_uintpdtype,
             #'HALF',
             'BYTE': self.w_int8dtype,
-            #'CFLOAT': ,
             #'TIMEDELTA',
             'INT': self.w_int32dtype,
             'DOUBLE': self.w_float64dtype,
@@ -856,7 +856,7 @@
                        space.wrap(dtype.num),
                        space.wrap(itemsize * 8), # in case of changing
                        # number of bits per byte in the future
-                       space.wrap(itemsize or 1)]
+                       space.wrap(itemsize / (2 if dtype.kind == COMPLEXLTR 
else 1) or 1)]
             if dtype.is_int_type():
                 if dtype.kind == BOOLLTR:
                     w_maxobj = space.wrap(1)
diff --git a/pypy/module/micronumpy/test/test_dtypes.py 
b/pypy/module/micronumpy/test/test_dtypes.py
--- a/pypy/module/micronumpy/test/test_dtypes.py
+++ b/pypy/module/micronumpy/test/test_dtypes.py
@@ -903,12 +903,14 @@
         BaseNumpyAppTest.setup_class.im_func(cls)
 
     def test_typeinfo(self):
-        from numpypy import void, number, int64, bool_
+        from numpypy import void, number, int64, bool_, complex64, complex128
         from numpypy.core.multiarray import typeinfo
         assert typeinfo['Number'] == number
         assert typeinfo['LONGLONG'] == ('q', 9, 64, 8, 9223372036854775807L, 
-9223372036854775808L, int64)
         assert typeinfo['VOID'] == ('V', 20, 0, 1, void)
         assert typeinfo['BOOL'] == ('?', 0, 8, 1, 1, 0, bool_)
+        assert typeinfo['CFLOAT'] == ('F', 14, 64, 4, complex64)
+        assert typeinfo['CDOUBLE'] == ('D', 15, 128, 8, complex128)
 
 class AppTestNoLongDoubleDtypes(BaseNumpyAppTest):
     def setup_class(cls):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to