[pypy-commit] pypy default: fix numpy test_abstract_types for 32bit

bdkearns noreply at buildbot.pypy.org
Sun Feb 10 05:28:10 CET 2013


Author: Brian Kearns <bdkearns at gmail.com>
Branch: 
Changeset: r61025:8556098ab5f0
Date: 2013-02-09 23:27 -0500
http://bitbucket.org/pypy/pypy/changeset/8556098ab5f0/

Log:	fix numpy test_abstract_types for 32bit

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
@@ -271,15 +271,22 @@
         assert 'unsignedinteger' in str(exc.value)
         raises(TypeError, numpy.floating, 0)
         raises(TypeError, numpy.inexact, 0)
+
         # numpy allows abstract types in array creation
-        a = numpy.array([4,4], numpy.integer)
-        assert a.dtype is numpy.dtype('int64')
-        a = numpy.array([4,4], numpy.number)
-        assert a.dtype is numpy.dtype('float')
-        a = numpy.array([4,4], numpy.signedinteger)
-        assert a.dtype is numpy.dtype('int64')
-        a = numpy.array([4,4], numpy.unsignedinteger)
-        assert a.dtype is numpy.dtype('uint64')
+        a_n = numpy.array([4,4], numpy.number)
+        a_i = numpy.array([4,4], numpy.integer)
+        a_s = numpy.array([4,4], numpy.signedinteger)
+        a_u = numpy.array([4,4], numpy.unsignedinteger)
+        if self.ptr_size == 4:
+            assert a_n.dtype is numpy.dtype('float32')
+            assert a_i.dtype is numpy.dtype('int32')
+            assert a_s.dtype is numpy.dtype('int32')
+            assert a_u.dtype is numpy.dtype('uint32')
+        else:
+            assert a_n.dtype is numpy.dtype('float64')
+            assert a_i.dtype is numpy.dtype('int64')
+            assert a_s.dtype is numpy.dtype('int64')
+            assert a_u.dtype is numpy.dtype('uint64')
         # too ambitious for now
         #a = numpy.array('xxxx', numpy.generic)
         #assert a.dtype is numpy.dtype('|V4')


More information about the pypy-commit mailing list