[pypy-commit] pypy default: cleanup and fix failing tests
mattip
noreply at buildbot.pypy.org
Sat Jul 18 22:38:43 CEST 2015
Author: mattip <matti.picus at gmail.com>
Branch:
Changeset: r78599:5d329a647a3f
Date: 2015-07-18 23:06 +0300
http://bitbucket.org/pypy/pypy/changeset/5d329a647a3f/
Log: cleanup and fix failing tests
diff --git a/pypy/module/micronumpy/descriptor.py b/pypy/module/micronumpy/descriptor.py
--- a/pypy/module/micronumpy/descriptor.py
+++ b/pypy/module/micronumpy/descriptor.py
@@ -950,7 +950,7 @@
raise oefmt(space.w_ValueError, "invalid shape in fixed-type tuple.")
else:
raise
- if dim > int(0x7fffffff):
+ if dim > 0x7fffffff:
raise oefmt(space.w_ValueError, "invalid shape in fixed-type tuple: "
"dimension does not fit into a C int.")
elif dim < 0:
@@ -977,7 +977,7 @@
assert isinstance(subdtype, W_Dtype)
size = support.product(shape)
size *= subdtype.elsize
- if size > int(0x7fffffff):
+ if size > 0x7fffffff:
raise oefmt(space.w_ValueError, "invalid shape in fixed-type tuple: "
"dtype size in bytes must fit into a C int.")
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
@@ -1067,6 +1067,12 @@
class AppTestRecordDtypes(BaseNumpyAppTest):
spaceconfig = dict(usemodules=["micronumpy", "struct", "binascii"])
+ def setup_class(cls):
+ BaseNumpyAppTest.setup_class.im_func(cls)
+ if option.runappdirect:
+ cls.w_test_for_core_internal = cls.space.wrap(True)
+ else:
+ cls.w_test_for_core_internal = cls.space.wrap(False)
def test_create(self):
from numpy import dtype, void
@@ -1307,6 +1313,11 @@
def test_aligned_size(self):
import numpy as np
+ if self.test_for_core_internal:
+ try:
+ from numpy.core import _internal
+ except ImportError:
+ skip ('no numpy.core._internal available')
# Check that structured dtypes get padded to an aligned size
dt = np.dtype('i4, i1', align=True)
assert dt.itemsize == 8
diff --git a/pypy/module/micronumpy/test/test_ndarray.py b/pypy/module/micronumpy/test/test_ndarray.py
--- a/pypy/module/micronumpy/test/test_ndarray.py
+++ b/pypy/module/micronumpy/test/test_ndarray.py
@@ -764,8 +764,9 @@
assert (a[1:] == b).all()
assert (a[1:,newaxis] == d).all()
assert (a[newaxis,1:] == c).all()
- assert a.strides == (8,)
- assert a[:, newaxis].strides == (8, 0)
+ n = a.dtype.itemsize
+ assert a.strides == (n,)
+ assert a[:, newaxis].strides == (n, 0)
def test_newaxis_assign(self):
from numpy import array, newaxis
More information about the pypy-commit
mailing list