[pypy-commit] pypy default: cleanup references to numpypy

bdkearns noreply at buildbot.pypy.org
Fri Dec 5 21:19:54 CET 2014


Author: Brian Kearns <bdkearns at gmail.com>
Branch: 
Changeset: r74839:642a5d4965d6
Date: 2014-12-05 15:12 -0500
http://bitbucket.org/pypy/pypy/changeset/642a5d4965d6/

Log:	cleanup references to numpypy

diff too long, truncating to 2000 out of 3730 lines

diff --git a/pypy/module/micronumpy/boxes.py b/pypy/module/micronumpy/boxes.py
--- a/pypy/module/micronumpy/boxes.py
+++ b/pypy/module/micronumpy/boxes.py
@@ -59,9 +59,9 @@
     _mixin_ = True
 
     def reduce(self, space):
-        numpypy = space.getbuiltinmodule("_numpypy")
-        assert isinstance(numpypy, MixedModule)
-        multiarray = numpypy.get("multiarray")
+        _numpypy = space.getbuiltinmodule("_numpypy")
+        assert isinstance(_numpypy, MixedModule)
+        multiarray = _numpypy.get("multiarray")
         assert isinstance(multiarray, MixedModule)
         scalar = multiarray.get("scalar")
 
diff --git a/pypy/module/micronumpy/ndarray.py b/pypy/module/micronumpy/ndarray.py
--- a/pypy/module/micronumpy/ndarray.py
+++ b/pypy/module/micronumpy/ndarray.py
@@ -1139,9 +1139,9 @@
         from pypy.interpreter.mixedmodule import MixedModule
         from pypy.module.micronumpy.concrete import SliceArray
 
-        numpypy = space.getbuiltinmodule("_numpypy")
-        assert isinstance(numpypy, MixedModule)
-        multiarray = numpypy.get("multiarray")
+        _numpypy = space.getbuiltinmodule("_numpypy")
+        assert isinstance(_numpypy, MixedModule)
+        multiarray = _numpypy.get("multiarray")
         assert isinstance(multiarray, MixedModule)
         reconstruct = multiarray.get("_reconstruct")
         parameters = space.newtuple([self.getclass(space), space.newtuple(
diff --git a/pypy/module/micronumpy/test/test_arrayops.py b/pypy/module/micronumpy/test/test_arrayops.py
--- a/pypy/module/micronumpy/test/test_arrayops.py
+++ b/pypy/module/micronumpy/test/test_arrayops.py
@@ -3,13 +3,13 @@
 
 class AppTestNumSupport(BaseNumpyAppTest):
     def test_zeros(self):
-        from numpypy import zeros
+        from numpy import zeros
         a = zeros(3)
         assert len(a) == 3
         assert a[0] == a[1] == a[2] == 0
 
     def test_empty(self):
-        from numpypy import empty
+        from numpy import empty
         import gc
         for i in range(1000):
             a = empty(3)
@@ -26,26 +26,26 @@
                 "empty() returned a zeroed out array every time")
 
     def test_where(self):
-        from numpypy import where, ones, zeros, array
+        from numpy import where, ones, zeros, array
         a = [1, 2, 3, 0, -3]
         a = where(array(a) > 0, ones(5), zeros(5))
         assert (a == [1, 1, 1, 0, 0]).all()
 
     def test_where_differing_dtypes(self):
-        from numpypy import array, ones, zeros, where
+        from numpy import array, ones, zeros, where
         a = [1, 2, 3, 0, -3]
         a = where(array(a) > 0, ones(5, dtype=int), zeros(5, dtype=float))
         assert (a == [1, 1, 1, 0, 0]).all()
 
     def test_where_broadcast(self):
-        from numpypy import array, where
+        from numpy import array, where
         a = where(array([[1, 2, 3], [4, 5, 6]]) > 3, [1, 1, 1], 2)
         assert (a == [[2, 2, 2], [1, 1, 1]]).all()
         a = where(True, [1, 1, 1], 2)
         assert (a == [1, 1, 1]).all()
 
     def test_where_errors(self):
-        from numpypy import where, array
+        from numpy import where, array
         raises(ValueError, "where([1, 2, 3], [3, 4, 5])")
         raises(ValueError, "where([1, 2, 3], [3, 4, 5], [6, 7])")
         assert where(True, 1, 2) == array(1)
@@ -58,14 +58,14 @@
     #    xxx
 
     def test_where_invalidates(self):
-        from numpypy import where, ones, zeros, array
+        from numpy import where, ones, zeros, array
         a = array([1, 2, 3, 0, -3])
         b = where(a > 0, ones(5), zeros(5))
         a[0] = 0
         assert (b == [1, 1, 1, 0, 0]).all()
 
     def test_dot_basic(self):
-        from numpypy import array, dot, arange
+        from numpy import array, dot, arange
         a = array(range(5))
         assert dot(a, a) == 30.0
 
@@ -100,7 +100,7 @@
         assert (dot([[1,2],[3,4]],[5,6]) == [17, 39]).all()
 
     def test_dot_constant(self):
-        from numpypy import array, dot
+        from numpy import array, dot
         a = array(range(5))
         b = a.dot(2.5)
         for i in xrange(5):
@@ -111,7 +111,7 @@
         assert c == 12.0
 
     def test_dot_out(self):
-        from numpypy import arange, dot
+        from numpy import arange, dot
         a = arange(12).reshape(3, 4)
         b = arange(12).reshape(4, 3)
         out = arange(9).reshape(3, 3)
@@ -124,19 +124,19 @@
                                 'right type, nr dimensions, and be a C-Array)')
 
     def test_choose_basic(self):
-        from numpypy import array
+        from numpy import array
         a, b, c = array([1, 2, 3]), array([4, 5, 6]), array([7, 8, 9])
         r = array([2, 1, 0]).choose([a, b, c])
         assert (r == [7, 5, 3]).all()
 
     def test_choose_broadcast(self):
-        from numpypy import array
+        from numpy import array
         a, b, c = array([1, 2, 3]), [4, 5, 6], 13
         r = array([2, 1, 0]).choose([a, b, c])
         assert (r == [13, 5, 3]).all()
 
     def test_choose_out(self):
-        from numpypy import array
+        from numpy import array
         a, b, c = array([1, 2, 3]), [4, 5, 6], 13
         r = array([2, 1, 0]).choose([a, b, c], out=None)
         assert (r == [13, 5, 3]).all()
@@ -146,7 +146,7 @@
         assert (a == [13, 5, 3]).all()
 
     def test_choose_modes(self):
-        from numpypy import array
+        from numpy import array
         a, b, c = array([1, 2, 3]), [4, 5, 6], 13
         raises(ValueError, "array([3, 1, 0]).choose([a, b, c])")
         raises(ValueError, "array([3, 1, 0]).choose([a, b, c], mode='raises')")
@@ -158,20 +158,20 @@
         assert (r == [4, 5, 3]).all()
 
     def test_choose_dtype(self):
-        from numpypy import array
+        from numpy import array
         a, b, c = array([1.2, 2, 3]), [4, 5, 6], 13
         r = array([2, 1, 0]).choose([a, b, c])
         assert r.dtype == float
 
     def test_choose_dtype_out(self):
-        from numpypy import array
+        from numpy import array
         a, b, c = array([1, 2, 3]), [4, 5, 6], 13
         x = array([0, 0, 0], dtype='i2')
         r = array([2, 1, 0]).choose([a, b, c], out=x)
         assert r.dtype == 'i2'
 
     def test_put_basic(self):
-        from numpypy import arange, array
+        from numpy import arange, array
         a = arange(5)
         a.put([0, 2], [-44, -55])
         assert (a == array([-44, 1, -55, 3, 4])).all()
@@ -183,7 +183,7 @@
         assert (a == array([0, 7, 2, 3, 4])).all()
 
     def test_put_modes(self):
-        from numpypy import array, arange
+        from numpy import array, arange
         a = arange(5)
         a.put(22, -5, mode='clip')
         assert (a == array([0, 1, 2, 3, -5])).all()
diff --git a/pypy/module/micronumpy/test/test_base.py b/pypy/module/micronumpy/test/test_base.py
--- a/pypy/module/micronumpy/test/test_base.py
+++ b/pypy/module/micronumpy/test/test_base.py
@@ -14,15 +14,12 @@
             else:
                 from . import dummy_module as numpy
                 sys.modules['numpy'] = numpy
-            sys.modules['numpypy'] = numpy
         else:
             import os
             path = os.path.dirname(__file__) + '/dummy_module.py'
             cls.space.appexec([cls.space.wrap(path)], """(path):
             import imp
-            numpy = imp.load_source('numpy', path)
-            import sys
-            sys.modules['numpypy'] = numpy
+            imp.load_source('numpy', path)
             """)
         cls.w_non_native_prefix = cls.space.wrap(NPY.OPPBYTE)
         cls.w_native_prefix = cls.space.wrap(NPY.NATBYTE)
diff --git a/pypy/module/micronumpy/test/test_complex.py b/pypy/module/micronumpy/test/test_complex.py
--- a/pypy/module/micronumpy/test/test_complex.py
+++ b/pypy/module/micronumpy/test/test_complex.py
@@ -132,13 +132,13 @@
             cls.w_c_pow = cls.space.wrap(interp2app(cls_c_pow))
 
     def test_fabs(self):
-        from numpypy import fabs, dtype
+        from numpy import fabs, dtype
 
         a = dtype('complex128').type(complex(-5., 5.))
         raises(TypeError, fabs, a)
 
     def test_fmax(self):
-        from numpypy import fmax, array
+        from numpy import fmax, array
         nnan, nan, inf, ninf = float('-nan'), float('nan'), float('inf'), float('-inf')
         a = array((complex(ninf, 10), complex(10, ninf),
                    complex( inf, 10), complex(10,  inf),
@@ -165,7 +165,7 @@
         assert (fmax(a, b) == res).all()
 
     def test_fmin(self):
-        from numpypy import fmin, array
+        from numpy import fmin, array
         nnan, nan, inf, ninf = float('-nan'), float('nan'), float('inf'), float('-inf')
         a = array((complex(ninf, 10), complex(10, ninf),
                    complex( inf, 10), complex(10,  inf),
@@ -192,11 +192,11 @@
         assert (fmin(a, b) == res).all()
 
     def test_signbit(self):
-        from numpypy import signbit
+        from numpy import signbit
         raises(TypeError, signbit, complex(1,1))
 
     def test_reciprocal(self):
-        from numpypy import array, reciprocal
+        from numpy import array, reciprocal
         inf = float('inf')
         nan = float('nan')
         #complex
@@ -218,21 +218,21 @@
                 assert (a[0].imag - e.imag) < rel_err
 
     def test_floorceiltrunc(self):
-        from numpypy import array, floor, ceil, trunc
+        from numpy import array, floor, ceil, trunc
         a = array([ complex(-1.4, -1.4), complex(-1.5, -1.5)])
         raises(TypeError, floor, a)
         raises(TypeError, ceil, a)
         raises(TypeError, trunc, a)
 
     def test_copysign(self):
-        from numpypy import copysign, dtype
+        from numpy import copysign, dtype
         complex128 = dtype('complex128').type
         a = complex128(complex(-5., 5.))
         b = complex128(complex(0., 0.))
         raises(TypeError, copysign, a, b)
 
     def test_exp2(self):
-        from numpypy import array, exp2
+        from numpy import array, exp2
         inf = float('inf')
         ninf = -float('inf')
         nan = float('nan')
@@ -268,7 +268,7 @@
 
     def test_expm1(self):
         import math, cmath
-        from numpypy import array, expm1
+        from numpy import array, expm1
         inf = float('inf')
         ninf = -float('inf')
         nan = float('nan')
@@ -307,7 +307,7 @@
                 self.rAlmostEqual(t1, t2, rel_err=rel_err, msg=msg)
 
     def test_not_complex(self):
-        from numpypy import (radians, deg2rad, degrees, rad2deg,
+        from numpy import (radians, deg2rad, degrees, rad2deg,
                   logaddexp, logaddexp2, fmod,
                   arctan2)
         raises(TypeError, radians, complex(90,90))
@@ -320,7 +320,7 @@
         raises (TypeError, fmod, complex(90,90), 3)
 
     def test_isnan_isinf(self):
-        from numpypy import isnan, isinf, array
+        from numpy import isnan, isinf, array
         assert (isnan(array([0.2+2j, complex(float('inf'),0),
                 complex(0,float('inf')), complex(0,float('nan')),
                 complex(float('nan'), 0)], dtype=complex)) == \
@@ -333,7 +333,7 @@
 
 
     def test_square(self):
-        from numpypy import square
+        from numpy import square
         assert square(complex(3, 4)) == complex(3,4) * complex(3, 4)
 
     def test_power_simple(self):
@@ -364,8 +364,8 @@
             self.rAlmostEqual(float(n_r_a[i].imag), float(p_r[i].imag), msg=msg)
 
     def test_conjugate(self):
-        from numpypy import conj, conjugate, dtype
-        import numpypy as np
+        from numpy import conj, conjugate, dtype
+        import numpy as np
 
         c0 = dtype('complex128').type(complex(2.5, 0))
         c1 = dtype('complex64').type(complex(1, 2))
@@ -390,7 +390,7 @@
     def test_logn(self):
         import math, cmath
         # log and log10 are tested in math (1:1 from rcomplex)
-        from numpypy import log2, array, log1p
+        from numpy import log2, array, log1p
         inf = float('inf')
         ninf = -float('inf')
         nan = float('nan')
@@ -447,7 +447,7 @@
                 self.rAlmostEqual(t1, t2, rel_err=rel_err, msg=msg)
 
     def test_logical_ops(self):
-        from numpypy import logical_and, logical_or, logical_xor, logical_not
+        from numpy import logical_and, logical_or, logical_xor, logical_not
 
         c1 = complex(1, 1)
         c3 = complex(3, 0)
@@ -461,7 +461,7 @@
         assert (logical_not([c1, c0]) == [False, True]).all()
 
     def test_minimum(self):
-        from numpypy import array, minimum
+        from numpy import array, minimum
 
         a = array([-5.0+5j, -5.0-5j, -0.0-10j, 1.0+10j])
         b = array([ 3.0+10.0j, 3.0, -2.0+2.0j, -3.0+4.0j])
@@ -470,7 +470,7 @@
             assert c[i] == min(a[i], b[i])
 
     def test_maximum(self):
-        from numpypy import array, maximum
+        from numpy import array, maximum
 
         a = array([-5.0+5j, -5.0-5j, -0.0-10j, 1.0+10j])
         b = array([ 3.0+10.0j, 3.0, -2.0+2.0j, -3.0+4.0j])
@@ -480,10 +480,10 @@
 
     def test_basic(self):
         import sys
-        from numpypy import (dtype, add, array, dtype,
+        from numpy import (dtype, add, array, dtype,
             subtract as sub, multiply, divide, negative, absolute as abs,
             floor_divide, real, imag, sign)
-        from numpypy import (equal, not_equal, greater, greater_equal, less,
+        from numpy import (equal, not_equal, greater, greater_equal, less,
                 less_equal, isnan)
         assert real(4.0) == 4.0
         assert imag(0.0) == 0.0
@@ -579,7 +579,7 @@
             assert repr(abs(inf_c)) == 'inf'
             assert repr(abs(complex(float('nan'), float('nan')))) == 'nan'
             # numpy actually raises an AttributeError,
-            # but numpypy raises a TypeError
+            # but numpy.raises a TypeError
             if '__pypy__' in sys.builtin_module_names:
                 exct, excm = TypeError, 'readonly attribute'
             else:
@@ -592,7 +592,7 @@
             assert(imag(c2) == 4.0)
 
     def test_conj(self):
-        from numpypy import array
+        from numpy import array
 
         a = array([1 + 2j, 1 - 2j])
         assert (a.conj() == [1 - 2j, 1 + 2j]).all()
@@ -603,7 +603,7 @@
         if self.isWindows:
             skip('windows does not support c99 complex')
         import sys
-        import numpypy as np
+        import numpy as np
         rAlmostEqual = self.rAlmostEqual
 
         for t, testcases in (
@@ -658,6 +658,6 @@
             sys.stderr.write('\n')
 
     def test_complexbox_to_pycomplex(self):
-        from numpypy import dtype
+        from numpy import dtype
         x = dtype('complex128').type(3.4j)
         assert complex(x) == 3.4j
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
@@ -23,7 +23,7 @@
             from numpy.core.multiarray import typeinfo
         except ImportError:
             # running on dummy module
-            from numpypy import typeinfo
+            from numpy import typeinfo
         assert typeinfo['Number'] == np.number
         assert typeinfo['LONGLONG'] == ('q', 9, 64, 8, 9223372036854775807L,
                                         -9223372036854775808L, np.longlong)
@@ -39,7 +39,7 @@
                                     np.dtype('int').type)
 
     def test_dtype_basic(self):
-        from numpypy import dtype
+        from numpy import dtype
         import sys
 
         d = dtype('?')
@@ -104,7 +104,7 @@
         assert d.shape == ()
 
     def test_dtype_eq(self):
-        from numpypy import dtype
+        from numpy import dtype
 
         assert dtype("int8") == "int8"
         assert "int8" == dtype("int8")
@@ -112,7 +112,7 @@
         assert dtype(bool) == bool
 
     def test_dtype_aliases(self):
-        from numpypy import dtype
+        from numpy import dtype
         assert dtype('bool8') is dtype('bool')
         assert dtype('byte') is dtype('int8')
         assert dtype('ubyte') is dtype('uint8')
@@ -132,7 +132,7 @@
         assert dtype('clongdouble').num in (15, 16)
 
     def test_dtype_with_types(self):
-        from numpypy import dtype
+        from numpy import dtype
 
         assert dtype(bool).num == 0
         if self.ptr_size == 4:
@@ -156,7 +156,7 @@
         assert dtype('complex').num == 15
 
     def test_array_dtype_attr(self):
-        from numpypy import array, dtype
+        from numpy import array, dtype
 
         a = array(range(5), long)
         assert a.dtype is dtype(long)
@@ -182,7 +182,7 @@
         assert np.dtype('S5').isbuiltin == 0
 
     def test_repr_str(self):
-        from numpypy import dtype
+        from numpy import dtype
         b = dtype(int).newbyteorder().newbyteorder().byteorder
         assert '.dtype' in repr(dtype)
         d = dtype('?')
@@ -208,7 +208,7 @@
         assert str(d) == "|V16"
 
     def test_bool_array(self):
-        from numpypy import array, False_, True_
+        from numpy import array, False_, True_
 
         a = array([0, 1, 2, 2.5], dtype='?')
         assert a[0] is False_
@@ -216,7 +216,7 @@
             assert a[i] is True_
 
     def test_copy_array_with_dtype(self):
-        from numpypy import array, longlong, False_
+        from numpy import array, longlong, False_
 
         a = array([0, 1, 2, 3], dtype=long)
         # int on 64-bit, long in 32-bit
@@ -230,35 +230,35 @@
         assert b[0] is False_
 
     def test_zeros_bool(self):
-        from numpypy import zeros, False_
+        from numpy import zeros, False_
 
         a = zeros(10, dtype=bool)
         for i in range(10):
             assert a[i] is False_
 
     def test_ones_bool(self):
-        from numpypy import ones, True_
+        from numpy import ones, True_
 
         a = ones(10, dtype=bool)
         for i in range(10):
             assert a[i] is True_
 
     def test_zeros_long(self):
-        from numpypy import zeros, longlong
+        from numpy import zeros, longlong
         a = zeros(10, dtype=long)
         for i in range(10):
             assert isinstance(a[i], longlong)
             assert a[1] == 0
 
     def test_ones_long(self):
-        from numpypy import ones, longlong
+        from numpy import ones, longlong
         a = ones(10, dtype=long)
         for i in range(10):
             assert isinstance(a[i], longlong)
             assert a[1] == 1
 
     def test_overflow(self):
-        from numpypy import array, dtype
+        from numpy import array, dtype
         assert array([128], 'b')[0] == -128
         assert array([256], 'B')[0] == 0
         assert array([32768], 'h')[0] == -32768
@@ -273,7 +273,7 @@
         raises(OverflowError, "array([2**64], 'Q')")
 
     def test_bool_binop_types(self):
-        from numpypy import array, dtype
+        from numpy import array, dtype
         types = [
             '?', 'b', 'B', 'h', 'H', 'i', 'I', 'l', 'L', 'q', 'Q', 'f', 'd',
             'e'
@@ -285,7 +285,7 @@
             assert (a + array([0], t)).dtype is dtype(t)
 
     def test_binop_types(self):
-        from numpypy import array, dtype
+        from numpy import array, dtype
         tests = [('b','B','h'), ('b','h','h'), ('b','H','i'), ('b','i','i'),
                  ('b','l','l'), ('b','q','q'), ('b','Q','d'), ('B','h','h'),
                  ('B','H','H'), ('B','i','i'), ('B','I','I'), ('B','l','l'),
@@ -309,7 +309,7 @@
             assert (d1, d2) == (d1, d2) and d3 is dtype(dout)
 
     def test_add(self):
-        import numpypy as np
+        import numpy as np
         for dtype in ["int8", "int16", "I"]:
             a = np.array(range(5), dtype=dtype)
             b = a + a
@@ -325,22 +325,22 @@
         assert len(d) == 2
 
     def test_shape(self):
-        from numpypy import dtype
+        from numpy import dtype
         assert dtype(long).shape == ()
 
     def test_cant_subclass(self):
-        from numpypy import dtype
+        from numpy import dtype
         # You can't subclass dtype
         raises(TypeError, type, "Foo", (dtype,), {})
 
     def test_can_subclass(self):
-        import numpypy
-        class xyz(numpypy.void):
+        import numpy
+        class xyz(numpy.void):
             pass
         assert True
 
     def test_index(self):
-        import numpypy as np
+        import numpy as np
         for dtype in [np.int8, np.int16, np.int32, np.int64]:
             a = np.array(range(10), dtype=dtype)
             b = np.array([0] * 10, dtype=dtype)
@@ -348,7 +348,7 @@
                 a[idx] += 1
 
     def test_hash(self):
-        import numpypy as numpy
+        import numpy
         for tp, value in [
             (numpy.int8, 4),
             (numpy.int16, 5),
@@ -395,7 +395,7 @@
 
     def test_pickle(self):
         import numpy as np
-        from numpypy import array, dtype
+        from numpy import array, dtype
         from cPickle import loads, dumps
         a = array([1,2,3])
         if self.ptr_size == 8:
@@ -408,7 +408,7 @@
         assert np.dtype(('<f8', 2)).__reduce__() == (dtype, ('V16', 0, 1), (3, '|', (dtype('float64'), (2,)), None, None, 16, 1, 0))
 
     def test_newbyteorder(self):
-        import numpypy as np
+        import numpy as np
         import sys
         sys_is_le = sys.byteorder == 'little'
         native_code = sys_is_le and '<' or '>'
@@ -480,7 +480,7 @@
 
 class AppTestTypes(BaseAppTestDtypes):
     def test_abstract_types(self):
-        import numpypy as numpy
+        import numpy
 
         raises(TypeError, numpy.generic, 0)
         raises(TypeError, numpy.number, 0)
@@ -526,16 +526,16 @@
         #assert a.dtype is numpy.dtype('|V4')
 
     def test_new(self):
-        import numpypy as np
+        import numpy as np
         assert np.int_(4) == 4
         assert np.float_(3.4) == 3.4
 
     def test_pow(self):
-        from numpypy import int_
+        from numpy import int_
         assert int_(4) ** 2 == 16
 
     def test_bool(self):
-        import numpypy as numpy
+        import numpy
 
         assert numpy.bool_.mro() == [numpy.bool_, numpy.generic, object]
         assert numpy.bool_(3) is numpy.True_
@@ -550,7 +550,7 @@
         assert numpy.bool_("False") is numpy.True_
 
     def test_int8(self):
-        import numpypy as numpy
+        import numpy
 
         assert numpy.int8.mro() == [numpy.int8, numpy.signedinteger,
                                     numpy.integer, numpy.number,
@@ -574,7 +574,7 @@
         assert numpy.int8('128') == -128
 
     def test_uint8(self):
-        import numpypy as numpy
+        import numpy
 
         assert numpy.uint8.mro() == [numpy.uint8, numpy.unsignedinteger,
                                      numpy.integer, numpy.number,
@@ -599,7 +599,7 @@
         assert numpy.uint8('256') == 0
 
     def test_int16(self):
-        import numpypy as numpy
+        import numpy
 
         x = numpy.int16(3)
         assert x == 3
@@ -641,7 +641,7 @@
             assert numpy.uint32('4294967296') == 0
 
     def test_int_(self):
-        import numpypy as numpy
+        import numpy
 
         assert numpy.int_ is numpy.dtype(int).type
         assert numpy.int_.mro() == [numpy.int_, numpy.signedinteger,
@@ -752,7 +752,7 @@
 
     def test_complex_format(self):
         import sys
-        import numpypy as numpy
+        import numpy
 
         for complex_ in (numpy.complex128, numpy.complex64,):
             for real, imag, should in [
@@ -792,7 +792,7 @@
             assert "{:g}".format(numpy.complex_(0.5+1.5j)) == '{:g}'.format(0.5+1.5j)
 
     def test_complex(self):
-        import numpypy as numpy
+        import numpy
 
         assert numpy.complex_ is numpy.complex128
         assert numpy.csingle is numpy.complex64
@@ -812,7 +812,7 @@
         assert d.char == 'F'
 
     def test_subclass_type(self):
-        import numpypy as numpy
+        import numpy
 
         class X(numpy.float64):
             def m(self):
@@ -826,12 +826,12 @@
         assert b.dtype.type is numpy.float64
 
     def test_long_as_index(self):
-        from numpypy import int_, float64
+        from numpy import int_, float64
         assert (1, 2, 3)[int_(1)] == 2
         raises(TypeError, lambda: (1, 2, 3)[float64(1)])
 
     def test_int(self):
-        from numpypy import int32, int64, int_
+        from numpy import int32, int64, int_
         import sys
         assert issubclass(int_, int)
         if sys.maxint == (1<<31) - 1:
@@ -842,7 +842,7 @@
             assert int_ is int64
 
     def test_various_types(self):
-        import numpypy as numpy
+        import numpy
 
         assert numpy.int16 is numpy.short
         assert numpy.int8 is numpy.byte
@@ -864,7 +864,7 @@
         assert not issubclass(numpy.longfloat, numpy.float64)
 
     def test_mro(self):
-        import numpypy as numpy
+        import numpy
 
         assert numpy.int16.__mro__ == (numpy.int16, numpy.signedinteger,
                                        numpy.integer, numpy.number,
@@ -873,7 +873,7 @@
 
     def test_operators(self):
         from operator import truediv
-        from numpypy import float64, int_, True_, False_
+        from numpy import float64, int_, True_, False_
         assert 5 / int_(2) == int_(2)
         assert truediv(int_(3), int_(2)) == float64(1.5)
         assert truediv(3, int_(2)) == float64(1.5)
@@ -899,7 +899,7 @@
 
     def test_alternate_constructs(self):
         import numpy as np
-        from numpypy import dtype
+        from numpy import dtype
         nnp = self.non_native_prefix
         byteorder = self.native_prefix
         assert dtype('i8') == dtype(byteorder + 'i8') == dtype('=i8') == dtype(long)
@@ -922,7 +922,7 @@
         assert d.str == '|S0'
 
     def test_dtype_str(self):
-        from numpypy import dtype
+        from numpy import dtype
         byteorder = self.native_prefix
         assert dtype('i8').str == byteorder + 'i8'
         assert dtype('<i8').str == '<i8'
@@ -949,7 +949,7 @@
         assert dtype(('f8', 2)).str == "|V16"
 
     def test_intp(self):
-        from numpypy import dtype
+        from numpy import dtype
         for s in ['p', 'int']:
             assert dtype(s) is dtype('intp')
         for s in ['P', 'uint']:
@@ -968,16 +968,16 @@
             assert dtype('P').name == 'uint64'
 
     def test_alignment(self):
-        from numpypy import dtype
+        from numpy import dtype
         assert dtype('i4').alignment == 4
 
     def test_isnative(self):
-        from numpypy import dtype
+        from numpy import dtype
         assert dtype('i4').isnative == True
         assert dtype('>i8').isnative == False
 
     def test_any_all_nonzero(self):
-        import numpypy as numpy
+        import numpy
         x = numpy.bool_(True)
         assert x.any() is numpy.True_
         assert x.all() is numpy.True_
@@ -1000,7 +1000,7 @@
         assert x.__nonzero__() is True
 
     def test_ravel(self):
-        from numpypy import float64, int8, array
+        from numpy import float64, int8, array
         x = float64(42.5).ravel()
         assert x.dtype == float64
         assert (x == array([42.5])).all()
@@ -1023,7 +1023,7 @@
 
 class AppTestStrUnicodeDtypes(BaseNumpyAppTest):
     def test_mro(self):
-        from numpypy import str_, unicode_, character, flexible, generic
+        from numpy import str_, unicode_, character, flexible, generic
         import sys
         if '__pypy__' in sys.builtin_module_names:
             assert str_.mro() == [str_, character, flexible, generic,
@@ -1037,7 +1037,7 @@
                                       flexible, generic, object]
 
     def test_str_dtype(self):
-        from numpypy import dtype, str_
+        from numpy import dtype, str_
 
         raises(TypeError, "dtype('Sx')")
         for t in ['S8', '|S8', '=S8']:
@@ -1058,7 +1058,7 @@
             assert d.str == '|S1'
 
     def test_unicode_dtype(self):
-        from numpypy import dtype, unicode_
+        from numpy import dtype, unicode_
 
         raises(TypeError, "dtype('Ux')")
         d = dtype('U8')
@@ -1070,11 +1070,11 @@
         assert d.num == 19
 
     def test_string_boxes(self):
-        from numpypy import str_
+        from numpy import str_
         assert isinstance(str_(3), str_)
 
     def test_unicode_boxes(self):
-        from numpypy import unicode_
+        from numpy import unicode_
         import sys
         if '__pypy__' in sys.builtin_module_names:
             exc = raises(NotImplementedError, unicode_, 3)
@@ -1085,7 +1085,7 @@
 
     def test_character_dtype(self):
         import numpy as np
-        from numpypy import array, character
+        from numpy import array, character
         x = array([["A", "B"], ["C", "D"]], character)
         assert (x == [["A", "B"], ["C", "D"]]).all()
         d = np.dtype('c')
@@ -1098,7 +1098,7 @@
     spaceconfig = dict(usemodules=["micronumpy", "struct", "binascii"])
 
     def test_create(self):
-        from numpypy import dtype, void
+        from numpy import dtype, void
 
         raises(ValueError, "dtype([('x', int), ('x', float)])")
         d = dtype([("x", "<i4"), ("y", "<f4"), ("z", "<u2"), ("v", "<f8")])
@@ -1157,7 +1157,7 @@
             raises(NotImplementedError, np.dtype, d)
 
     def test_create_subarrays(self):
-        from numpypy import dtype
+        from numpy import dtype
         d = dtype([("x", "float", (2,)), ("y", "int64", (2,))])
         assert d.itemsize == 32
         assert d.name == "void256"
@@ -1278,7 +1278,7 @@
         assert repr(d) == "dtype([('f0', '<f8'), ('f1', '<f8')])"
 
     def test_pickle_record(self):
-        from numpypy import array, dtype
+        from numpy import array, dtype
         from cPickle import loads, dumps
 
         d = dtype([("x", "int32"), ("y", "int32"), ("z", "int32"), ("value", float)])
@@ -1289,7 +1289,7 @@
         assert new_d.__reduce__() == d.__reduce__()
 
     def test_pickle_record_subarrays(self):
-        from numpypy import array, dtype
+        from numpy import array, dtype
         from cPickle import loads, dumps
 
         d = dtype([("x", "int32", (3,)), ("y", "int32", (2,)), ("z", "int32", (4,)), ("value", float, (5,))])
@@ -1321,7 +1321,7 @@
             cls.w_check_non_native = cls.space.wrap(interp2app(check_non_native))
 
     def test_non_native(self):
-        from numpypy import array
+        from numpy import array
         a = array([1, 2, 3], dtype=self.non_native_prefix + 'i2')
         assert a[0] == 1
         assert (a + a)[1] == 4
@@ -1344,7 +1344,7 @@
 
 class AppTestObjectDtypes(BaseNumpyAppTest):
     def test_scalar_from_object(self):
-        from numpypy import array
+        from numpy import array
         import sys
         class Polynomial(object):
             pass
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
@@ -269,13 +269,13 @@
                 assert not a.flags['F']
 
     def test_ndmin(self):
-        from numpypy import array
+        from numpy import array
 
         arr = array([[[1]]], ndmin=1)
         assert arr.shape == (1, 1, 1)
 
     def test_noop_ndmin(self):
-        from numpypy import array
+        from numpy import array
         arr = array([1], ndmin=3)
         assert arr.shape == (1, 1, 1)
 
@@ -289,7 +289,7 @@
         assert a.dtype == np.intp
 
     def test_array_copy(self):
-        from numpypy import array
+        from numpy import array
         a = array(range(12)).reshape(3,4)
         b = array(a, ndmin=4)
         assert b.shape == (1, 1, 3, 4)
@@ -353,12 +353,12 @@
         assert str(exc.value) == 'buffer is read-only'
 
     def test_type(self):
-        from numpypy import array
+        from numpy import array
         ar = array(range(5))
         assert type(ar) is type(ar + ar)
 
     def test_ndim(self):
-        from numpypy import array
+        from numpy import array
         x = array(0.2)
         assert x.ndim == 0
         x = array([1, 2])
@@ -367,12 +367,12 @@
         assert x.ndim == 2
         x = array([[[1, 2], [3, 4]], [[5, 6], [7, 8]]])
         assert x.ndim == 3
-        # numpy actually raises an AttributeError, but numpypy raises an
+        # numpy actually raises an AttributeError, but numpy.raises an
         # TypeError
         raises((TypeError, AttributeError), 'x.ndim = 3')
 
     def test_zeros(self):
-        from numpypy import zeros
+        from numpy import zeros
         a = zeros(15)
         # Check that storage was actually zero'd.
         assert a[10] == 0.0
@@ -431,7 +431,7 @@
         assert type(b) is np.ndarray
 
     def test_size(self):
-        from numpypy import array,arange,cos
+        from numpy import array,arange,cos
         assert array(3).size == 1
         a = array([1, 2, 3])
         assert a.size == 3
@@ -440,13 +440,13 @@
         assert ten == 10
 
     def test_empty(self):
-        from numpypy import empty
+        from numpy import empty
         a = empty(2)
         a[1] = 1.0
         assert a[1] == 1.0
 
     def test_ones(self):
-        from numpypy import ones, dtype
+        from numpy import ones, dtype
         a = ones(3)
         assert len(a) == 3
         assert a[0] == 1
@@ -458,7 +458,7 @@
         assert b.dtype is dtype(complex)
 
     def test_arange(self):
-        from numpypy import arange, dtype
+        from numpy import arange, dtype
         a = arange(3)
         assert (a == [0, 1, 2]).all()
         assert a.dtype is dtype(int)
@@ -480,7 +480,7 @@
         assert arange(False, True, True).dtype is dtype(int)
 
     def test_copy(self):
-        from numpypy import arange, array
+        from numpy import arange, array
         a = arange(5)
         b = a.copy()
         for i in xrange(5):
@@ -522,7 +522,7 @@
             raises(NotImplementedError, a.copy, order=True)
 
     def test_iterator_init(self):
-        from numpypy import array
+        from numpy import array
         a = array(range(5))
         assert a[3] == 3
 
@@ -546,7 +546,7 @@
         assert (a == [[1], [2]]).all()
 
     def test_getitem(self):
-        from numpypy import array
+        from numpy import array
         a = array(range(5))
         raises(IndexError, "a[5]")
         a = a + a
@@ -555,14 +555,14 @@
         raises(IndexError, "a[-6]")
 
     def test_getitem_float(self):
-        from numpypy import array
+        from numpy import array
         a = array([1, 2, 3, 4])
         assert a[1.2] == 2
         assert a[1.6] == 2
         assert a[-1.2] == 4
 
     def test_getitem_tuple(self):
-        from numpypy import array
+        from numpy import array
         a = array(range(5))
         raises(IndexError, "a[(1,2)]")
         for i in xrange(5):
@@ -572,28 +572,28 @@
             assert a[i] == b[i]
 
     def test_getitem_nd(self):
-        from numpypy import arange
+        from numpy import arange
         a = arange(15).reshape(3, 5)
         assert a[1, 3] == 8
         assert a.T[1, 2] == 11
 
     def test_getitem_obj_index(self):
-        from numpypy import arange
+        from numpy import arange
         a = arange(10)
         assert a[self.CustomIndexObject(1)] == 1
 
     def test_getitem_obj_prefer_index_to_int(self):
-        from numpypy import arange
+        from numpy import arange
         a = arange(10)
         assert a[self.CustomIndexIntObject(0, 1)] == 0
 
     def test_getitem_obj_int(self):
-        from numpypy import arange
+        from numpy import arange
         a = arange(10)
         assert a[self.CustomIntObject(1)] == 1
 
     def test_setitem(self):
-        from numpypy import array
+        from numpy import array
         a = array(range(5))
         a[-1] = 5.0
         assert a[4] == 5.0
@@ -612,7 +612,7 @@
         assert a[2] == -0.005
 
     def test_setitem_tuple(self):
-        from numpypy import array
+        from numpy import array
         a = array(range(5))
         raises(IndexError, "a[(1,2)] = [0,1]")
         for i in xrange(5):
@@ -630,25 +630,25 @@
         assert a[2] == 100
 
     def test_setitem_obj_index(self):
-        from numpypy import arange
+        from numpy import arange
         a = arange(10)
         a[self.CustomIndexObject(1)] = 100
         assert a[1] == 100
 
     def test_setitem_obj_prefer_index_to_int(self):
-        from numpypy import arange
+        from numpy import arange
         a = arange(10)
         a[self.CustomIndexIntObject(0, 1)] = 100
         assert a[0] == 100
 
     def test_setitem_obj_int(self):
-        from numpypy import arange
+        from numpy import arange
         a = arange(10)
         a[self.CustomIntObject(1)] = 100
         assert a[1] == 100
 
     def test_delitem(self):
-        import numpypy as np
+        import numpy as np
         a = np.arange(10)
         exc = raises(ValueError, 'del a[2]')
         assert exc.value.message == 'cannot delete array elements'
@@ -665,7 +665,7 @@
         # numpy will swallow errors in __int__ and __index__ and
         # just raise IndexError.
 
-        from numpypy import arange
+        from numpy import arange
         a = arange(10)
         exc = raises(IndexError, "a[ErrorIndex()] == 0")
         assert exc.value.message == 'cannot convert index to integer'
@@ -673,7 +673,7 @@
         assert exc.value.message == 'cannot convert index to integer'
 
     def test_setslice_array(self):
-        from numpypy import array
+        from numpy import array
         a = array(5)
         exc = raises(ValueError, "a[:] = 4")
         assert exc.value[0] == "cannot slice a 0-d array"
@@ -687,7 +687,7 @@
         assert b[1] == 0.
 
     def test_setslice_of_slice_array(self):
-        from numpypy import array, zeros
+        from numpy import array, zeros
         a = zeros(5)
         a[::2] = array([9., 10., 11.])
         assert a[0] == 9.
@@ -706,7 +706,7 @@
         assert a[0] == 3.
 
     def test_setslice_list(self):
-        from numpypy import array
+        from numpy import array
         a = array(range(5), float)
         b = [0., 1.]
         a[1:4:2] = b
@@ -714,7 +714,7 @@
         assert a[3] == 1.
 
     def test_setslice_constant(self):
-        from numpypy import array
+        from numpy import array
         a = array(range(5), float)
         a[1:4:2] = 0.
         assert a[1] == 0.
@@ -722,7 +722,7 @@
 
     def test_newaxis(self):
         import math
-        from numpypy import array, cos, zeros, newaxis
+        from numpy import array, cos, zeros, newaxis
         a = array(range(5))
         b = array([range(5)])
         assert (a[newaxis] == b).all()
@@ -743,7 +743,7 @@
         assert o == 3
 
     def test_newaxis_slice(self):
-        from numpypy import array, newaxis
+        from numpy import array, newaxis
 
         a = array(range(5))
         b = array(range(1,5))
@@ -755,14 +755,14 @@
         assert (a[newaxis,1:] == c).all()
 
     def test_newaxis_assign(self):
-        from numpypy import array, newaxis
+        from numpy import array, newaxis
 
         a = array(range(5))
         a[newaxis,1] = [2]
         assert a[1] == 2
 
     def test_newaxis_virtual(self):
-        from numpypy import array, newaxis
+        from numpy import array, newaxis
 
         a = array(range(5))
         b = (a + a)[newaxis]
@@ -770,20 +770,20 @@
         assert (b == c).all()
 
     def test_newaxis_then_slice(self):
-        from numpypy import array, newaxis
+        from numpy import array, newaxis
         a = array(range(5))
         b = a[newaxis]
         assert b.shape == (1, 5)
         assert (b[0,1:] == a[1:]).all()
 
     def test_slice_then_newaxis(self):
-        from numpypy import array, newaxis
+        from numpy import array, newaxis
         a = array(range(5))
         b = a[2:]
         assert (b[newaxis] == [[2, 3, 4]]).all()
 
     def test_scalar(self):
-        from numpypy import array, dtype, int_
+        from numpy import array, dtype, int_
         a = array(3)
         exc = raises(IndexError, "a[0]")
         assert exc.value[0] == "0-d arrays can't be indexed"
@@ -816,13 +816,13 @@
         assert a == 2.5
 
     def test_len(self):
-        from numpypy import array
+        from numpy import array
         a = array(range(5))
         assert len(a) == 5
         assert len(a + a) == 5
 
     def test_shape(self):
-        from numpypy import array
+        from numpy import array
         a = array(range(5))
         assert a.shape == (5,)
         b = a + a
@@ -832,7 +832,7 @@
         assert array([]).shape == (0,)
 
     def test_set_shape(self):
-        from numpypy import array, zeros
+        from numpy import array, zeros
         a = array([])
         raises(ValueError, "a.shape = []")
         a = array(range(12))
@@ -855,7 +855,7 @@
         raises(AttributeError, 'a.shape = 6')
 
     def test_reshape(self):
-        from numpypy import array, zeros
+        from numpy import array, zeros
         for a in [array(1), array([1])]:
             for s in [(), (1,)]:
                 b = a.reshape(s)
@@ -902,7 +902,7 @@
             raises(NotImplementedError, a.reshape, (0,), order='F')
 
     def test_slice_reshape(self):
-        from numpypy import zeros, arange
+        from numpy import zeros, arange
         a = zeros((4, 2, 3))
         b = a[::2, :, :]
         b.shape = (2, 6)
@@ -938,32 +938,32 @@
         raises(ValueError, arange(10).reshape, (5, -1, -1))
 
     def test_reshape_varargs(self):
-        from numpypy import arange
+        from numpy import arange
         z = arange(96).reshape(12, -1)
         y = z.reshape(4, 3, 8)
         assert y.shape == (4, 3, 8)
 
     def test_scalar_reshape(self):
-        from numpypy import array
+        from numpy import array
         a = array(3)
         assert a.reshape([1, 1]).shape == (1, 1)
         assert a.reshape([1]).shape == (1,)
         raises(ValueError, "a.reshape(3)")
 
     def test_strides(self):
-        from numpypy import array
+        from numpy import array
         a = array([[1.0, 2.0],
                    [3.0, 4.0]])
         assert a.strides == (16, 8)
         assert a[1:].strides == (16, 8)
 
     def test_strides_scalar(self):
-        from numpypy import array
+        from numpy import array
         a = array(42)
         assert a.strides == ()
 
     def test_add(self):
-        from numpypy import array
+        from numpy import array
         a = array(range(5))
         b = a + a
         for i in range(5):
@@ -976,7 +976,7 @@
             assert c[i] == bool(a[i] + b[i])
 
     def test_add_other(self):
-        from numpypy import array
+        from numpy import array
         a = array(range(5))
         b = array([i for i in reversed(range(5))])
         c = a + b
@@ -984,14 +984,14 @@
             assert c[i] == 4
 
     def test_add_constant(self):
-        from numpypy import array
+        from numpy import array
         a = array(range(5))
         b = a + 5
         for i in range(5):
             assert b[i] == i + 5
 
     def test_radd(self):
-        from numpypy import array
+        from numpy import array
         r = 3 + array(range(3))
         for i in range(3):
             assert r[i] == i + 3
@@ -999,7 +999,7 @@
         assert (r == [2, 4]).all()
 
     def test_inline_op_scalar(self):
-        from numpypy import array
+        from numpy import array
         for op in [
                 '__iadd__',
                 '__isub__',
@@ -1018,7 +1018,7 @@
             assert id(a) == id(b)
 
     def test_inline_op_array(self):
-        from numpypy import array
+        from numpy import array
         for op in [
                 '__iadd__',
                 '__isub__',
@@ -1042,7 +1042,7 @@
                 assert a[i] == getattr(c[i], reg_op).__call__(d[i])
 
     def test_add_list(self):
-        from numpypy import array, ndarray
+        from numpy import array, ndarray
         a = array(range(5))
         b = list(reversed(range(5)))
         c = a + b
@@ -1051,14 +1051,14 @@
             assert c[i] == 4
 
     def test_subtract(self):
-        from numpypy import array
+        from numpy import array
         a = array(range(5))
         b = a - a
         for i in range(5):
             assert b[i] == 0
 
     def test_subtract_other(self):
-        from numpypy import array
+        from numpy import array
         a = array(range(5))
         b = array([1, 1, 1, 1, 1])
         c = a - b
@@ -1066,37 +1066,37 @@
             assert c[i] == i - 1
 
     def test_subtract_constant(self):
-        from numpypy import array
+        from numpy import array
         a = array(range(5))
         b = a - 5
         for i in range(5):
             assert b[i] == i - 5
 
     def test_scalar_subtract(self):
-        from numpypy import dtype
+        from numpy import dtype
         int32 = dtype('int32').type
         assert int32(2) - 1 == 1
         assert 1 - int32(2) == -1
 
     def test_mul(self):
-        import numpypy
-
-        a = numpypy.array(range(5))
+        import numpy
+
+        a = numpy.array(range(5))
         b = a * a
         for i in range(5):
             assert b[i] == i * i
         assert b.dtype is a.dtype
 
-        a = numpypy.array(range(5), dtype=bool)
+        a = numpy.array(range(5), dtype=bool)
         b = a * a
-        assert b.dtype is numpypy.dtype(bool)
-        bool_ = numpypy.dtype(bool).type
+        assert b.dtype is numpy.dtype(bool)
+        bool_ = numpy.dtype(bool).type
         assert b[0] is bool_(False)
         for i in range(1, 5):
             assert b[i] is bool_(True)
 
     def test_mul_constant(self):
-        from numpypy import array
+        from numpy import array
         a = array(range(5))
         b = a * 5
         for i in range(5):
@@ -1104,7 +1104,7 @@
 
     def test_div(self):
         from math import isnan
-        from numpypy import array, dtype
+        from numpy import array, dtype
 
         a = array(range(1, 6))
         b = a / a
@@ -1136,7 +1136,7 @@
         assert c[2] == float('-inf')
 
     def test_div_other(self):
-        from numpypy import array
+        from numpy import array
         a = array(range(5))
         b = array([2, 2, 2, 2, 2], float)
         c = a / b
@@ -1144,7 +1144,7 @@
             assert c[i] == i / 2.0
 
     def test_div_constant(self):
-        from numpypy import array
+        from numpy import array
         a = array(range(5))
         b = a / 5.0
         for i in range(5):
@@ -1152,7 +1152,7 @@
 
     def test_floordiv(self):
         from math import isnan
-        from numpypy import array, dtype
+        from numpy import array, dtype
 
         a = array(range(1, 6))
         b = a // a
@@ -1182,26 +1182,26 @@
         assert c[2] == float('-inf')
 
     def test_floordiv_other(self):
-        from numpypy import array
+        from numpy import array
         a = array(range(5))
         b = array([2, 2, 2, 2, 2], float)
         c = a // b
         assert (c == [0, 0, 1, 1, 2]).all()
 
     def test_rfloordiv(self):
-        from numpypy import array
+        from numpy import array
         a = array(range(1, 6))
         b = 3 // a
         assert (b == [3, 1, 1, 0, 0]).all()
 
     def test_floordiv_constant(self):
-        from numpypy import array
+        from numpy import array
         a = array(range(5))
         b = a // 2
         assert (b == [0, 0, 1, 1, 2]).all()
 
     def test_signed_integer_division_overflow(self):
-        import numpypy as np
+        import numpy as np
         for s in (8, 16, 32, 64):
             for o in ['__div__', '__floordiv__']:
                 a = np.array([-2**(s-1)], dtype='int%d' % s)
@@ -1209,27 +1209,27 @@
 
     def test_truediv(self):
         from operator import truediv
-        from numpypy import arange
+        from numpy import arange
 
         assert (truediv(arange(5), 2) == [0., .5, 1., 1.5, 2.]).all()
         assert (truediv(2, arange(3)) == [float("inf"), 2., 1.]).all()
 
     def test_divmod(self):
-        from numpypy import arange
+        from numpy import arange
 
         a, b = divmod(arange(10), 3)
         assert (a == [0, 0, 0, 1, 1, 1, 2, 2, 2, 3]).all()
         assert (b == [0, 1, 2, 0, 1, 2, 0, 1, 2, 0]).all()
 
     def test_rdivmod(self):
-        from numpypy import arange
+        from numpy import arange
 
         a, b = divmod(3, arange(1, 5))
         assert (a == [3, 1, 1, 0]).all()
         assert (b == [0, 1, 0, 3]).all()
 
     def test_lshift(self):
-        from numpypy import array
+        from numpy import array
 
         a = array([0, 1, 2, 3])
         assert (a << 2 == [0, 4, 8, 12]).all()
@@ -1239,7 +1239,7 @@
         raises(TypeError, lambda: a << 2)
 
     def test_rlshift(self):
-        from numpypy import arange
+        from numpy import arange
 
         a = arange(3)
         assert (2 << a == [2, 4, 8]).all()
@@ -1261,13 +1261,13 @@
         assert 'not supported for the input types' in exc.value.message
 
     def test_rrshift(self):
-        from numpypy import arange
+        from numpy import arange
 
         a = arange(5)
         assert (2 >> a == [2, 1, 0, 0, 0]).all()
 
     def test_pow(self):
-        from numpypy import array
+        from numpy import array
         a = array(range(5), float)
         b = a ** a
         for i in range(5):
@@ -1277,7 +1277,7 @@
         assert (a ** 2 == a * a).all()
 
     def test_pow_other(self):
-        from numpypy import array
+        from numpy import array
         a = array(range(5), float)
         b = array([2, 2, 2, 2, 2])
         c = a ** b
@@ -1285,14 +1285,14 @@
             assert c[i] == i ** 2
 
     def test_pow_constant(self):
-        from numpypy import array
+        from numpy import array
         a = array(range(5), float)
         b = a ** 2
         for i in range(5):
             assert b[i] == i ** 2
 
     def test_mod(self):
-        from numpypy import array
+        from numpy import array
         a = array(range(1, 6))
         b = a % a
         for i in range(5):
@@ -1305,7 +1305,7 @@
             assert b[i] == 1
 
     def test_mod_other(self):
-        from numpypy import array
+        from numpy import array
         a = array(range(5))
         b = array([2, 2, 2, 2, 2])
         c = a % b
@@ -1313,38 +1313,38 @@
             assert c[i] == i % 2
 
     def test_mod_constant(self):
-        from numpypy import array
+        from numpy import array
         a = array(range(5))
         b = a % 2
         for i in range(5):
             assert b[i] == i % 2
 
     def test_rand(self):
-        from numpypy import arange
+        from numpy import arange
 
         a = arange(5)
         assert (3 & a == [0, 1, 2, 3, 0]).all()
 
     def test_ror(self):
-        from numpypy import arange
+        from numpy import arange
 
         a = arange(5)
         assert (3 | a == [3, 3, 3, 3, 7]).all()
 
     def test_xor(self):
-        from numpypy import arange
+        from numpy import arange
 
         a = arange(5)
         assert (a ^ 3 == [3, 2, 1, 0, 7]).all()
 
     def test_rxor(self):
-        from numpypy import arange
+        from numpy import arange
 
         a = arange(5)
         assert (3 ^ a == [3, 2, 1, 0, 7]).all()
 
     def test_pos(self):
-        from numpypy import array
+        from numpy import array
         a = array([1., -2., 3., -4., -5.])
         b = +a
         for i in range(5):
@@ -1355,7 +1355,7 @@
             assert a[i] == i
 
     def test_neg(self):
-        from numpypy import array
+        from numpy import array
         a = array([1., -2., 3., -4., -5.])
         b = -a
         for i in range(5):
@@ -1366,7 +1366,7 @@
             assert a[i] == -i
 
     def test_abs(self):
-        from numpypy import array
+        from numpy import array
         a = array([1., -2., 3., -4., -5.])
         b = abs(a)
         for i in range(5):
@@ -1377,7 +1377,7 @@
             assert a[i + 5] == abs(i)
 
     def test_auto_force(self):
-        from numpypy import array
+        from numpy import array
         a = array(range(5))
         b = a - 1
         a[2] = 3
@@ -1391,7 +1391,7 @@
         assert c[1] == 4
 
     def test_getslice(self):
-        from numpypy import array
+        from numpy import array
         a = array(5)
         exc = raises(ValueError, "a[:]")
         assert exc.value[0] == "cannot slice a 0-d array"
@@ -1408,7 +1408,7 @@
         assert s[0] == 5
 
     def test_getslice_step(self):
-        from numpypy import array
+        from numpy import array
         a = array(range(10))
         s = a[1:9:2]
         assert len(s) == 4
@@ -1416,7 +1416,7 @@
             assert s[i] == a[2 * i + 1]
 
     def test_slice_update(self):
-        from numpypy import array
+        from numpy import array
         a = array(range(5))
         s = a[0:3]
         s[1] = 10
@@ -1426,7 +1426,7 @@
 
     def test_slice_invaidate(self):
         # check that slice shares invalidation list with
-        from numpypy import array
+        from numpy import array
         a = array(range(5))
         s = a[0:2]
         b = array([10, 11])
@@ -1440,7 +1440,7 @@
         assert d[1] == 12
 
     def test_sum(self):
-        from numpypy import array, zeros, float16, complex64, str_
+        from numpy import array, zeros, float16, complex64, str_
         a = array(range(5))
         assert a.sum() == 10
         assert a[:4].sum() == 6
@@ -1470,7 +1470,7 @@
         assert list(zeros((0, 2)).sum(axis=1)) == []
 
     def test_reduce_nd(self):
-        from numpypy import arange, array
+        from numpy import arange, array
         a = arange(15).reshape(5, 3)
         assert a.sum() == 105
         assert a.sum(keepdims=True) == 105
@@ -1504,7 +1504,7 @@
         assert (array([[1,2],[3,4]]).prod(1) == [2, 12]).all()
 
     def test_prod(self):
-        from numpypy import array, dtype
+        from numpy import array, dtype
         a = array(range(1, 6))
         assert a.prod() == 120.0
         assert a.prod(keepdims=True) == 120.0
@@ -1520,7 +1520,7 @@
             assert a.prod().dtype is dtype(dt)
 
     def test_max(self):
-        from numpypy import array, zeros
+        from numpy import array, zeros
         a = array([-1.2, 3.4, 5.7, -3.0, 2.7])
         assert a.max() == 5.7
         assert a.max().shape == ()
@@ -1533,12 +1533,12 @@
         assert list(zeros((0, 2)).max(axis=1)) == []
 
     def test_max_add(self):
-        from numpypy import array
+        from numpy import array
         a = array([-1.2, 3.4, 5.7, -3.0, 2.7])
         assert (a + a).max() == 11.4
 
     def test_min(self):
-        from numpypy import array, zeros
+        from numpy import array, zeros
         a = array([-1.2, 3.4, 5.7, -3.0, 2.7])
         assert a.min() == -3.0
         assert a.min().shape == ()
@@ -1551,7 +1551,7 @@
         assert list(zeros((0, 2)).min(axis=1)) == []
 
     def test_argmax(self):
-        from numpypy import array
+        from numpy import array
         a = array([-1.2, 3.4, 5.7, -3.0, 2.7])
         r = a.argmax()
         assert r == 2
@@ -1580,7 +1580,7 @@
             raises(NotImplementedError, a.argmax, axis=0)
 
     def test_argmin(self):
-        from numpypy import array
+        from numpy import array
         a = array([-1.2, 3.4, 5.7, -3.0, 2.7])
         assert a.argmin() == 3
         assert a.argmin(axis=None, out=None) == 3
@@ -1591,7 +1591,7 @@
             raises(NotImplementedError, a.argmin, axis=0)
 
     def test_all(self):
-        from numpypy import array
+        from numpy import array
         a = array(range(5))
         assert a.all() == False
         a[0] = 3.0
@@ -1602,7 +1602,7 @@
         assert b.all() == True
 
     def test_any(self):
-        from numpypy import array, zeros
+        from numpy import array, zeros
         a = array(range(5))
         assert a.any() == True
         assert a.any(keepdims=True) == True
@@ -1613,7 +1613,7 @@
         assert c.any() == False
 
     def test_dtype_guessing(self):
-        from numpypy import array, dtype
+        from numpy import array, dtype
         import sys
         assert array([True]).dtype is dtype(bool)
         assert array([True, False]).dtype is dtype(bool)
@@ -1639,7 +1639,7 @@
 
     def test_comparison(self):
         import operator
-        from numpypy import array, dtype
+        from numpy import array, dtype
 
         a = array(range(5))
         b = array(range(5), float)
@@ -1658,7 +1658,7 @@
                 assert c[i] == func(b[i], 3)
 
     def test___nonzero__(self):
-        from numpypy import array
+        from numpy import array
         a = array([1, 2])
         raises(ValueError, bool, a)
         raises(ValueError, bool, a == a)
@@ -1668,7 +1668,7 @@
         assert not bool(array([0]))
 
     def test_slice_assignment(self):
-        from numpypy import array
+        from numpy import array
         a = array(range(5))
         a[::-1] = a
         assert (a == [4, 3, 2, 1, 0]).all()
@@ -1678,7 +1678,7 @@
         assert (a == [8, 6, 4, 2, 0]).all()
 
     def test_virtual_views(self):
-        from numpypy import arange
+        from numpy import arange
         a = arange(15)
         c = (a + a)
         d = c[::2]
@@ -1696,7 +1696,7 @@
         assert b[1] == 2
 
     def test_realimag_views(self):
-        from numpypy import arange, array
+        from numpy import arange, array
         a = array(1.5)
         assert a.real == 1.5
         assert a.imag == 0.0
@@ -1743,7 +1743,7 @@
         assert arange(4, dtype='<c8').real.max() == 3.0
 
     def test_scalar_view(self):
-        from numpypy import array
+        from numpy import array
         a = array(3, dtype='int32')
         b = a.view(dtype='float32')
         assert b.shape == ()
@@ -1770,7 +1770,7 @@
         assert b.imag.tostring() == '\x00' * 4
 
     def test_array_view(self):
-        from numpypy import array, dtype
+        from numpy import array, dtype
         x = array((1, 2), dtype='int8')
         assert x.shape == (2,)
         y = x.view(dtype='int16')
@@ -1803,12 +1803,12 @@
         assert a.view('S16')[0] == '\x01' + '\x00' * 7 + '\x02'
 
     def test_ndarray_view_empty(self):
-        from numpypy import array, dtype
+        from numpy import array, dtype
         x = array([], dtype=[('a', 'int8'), ('b', 'int8')])
         y = x.view(dtype='int16')
 
     def test_tolist_scalar(self):
-        from numpypy import dtype
+        from numpy import dtype
         int32 = dtype('int32').type
         bool_ = dtype('bool').type
         x = int32(23)
@@ -1818,13 +1818,13 @@
         assert y.tolist() is True
 
     def test_tolist_zerodim(self):
-        from numpypy import array
+        from numpy import array
         x = array(3)
         assert x.tolist() == 3
         assert type(x.tolist()) is int
 
     def test_tolist_singledim(self):
-        from numpypy import array
+        from numpy import array
         a = array(range(5))
         assert a.tolist() == [0, 1, 2, 3, 4]
         assert type(a.tolist()[0]) is int
@@ -1832,23 +1832,23 @@
         assert b.tolist() == [0.2, 0.4, 0.6]
 
     def test_tolist_multidim(self):
-        from numpypy import array
+        from numpy import array
         a = array([[1, 2], [3, 4]])
         assert a.tolist() == [[1, 2], [3, 4]]
 
     def test_tolist_view(self):
-        from numpypy import array
+        from numpy import array
         a = array([[1, 2], [3, 4]])
         assert (a + a).tolist() == [[2, 4], [6, 8]]
 
     def test_tolist_slice(self):
-        from numpypy import array
+        from numpy import array
         a = array([[17.1, 27.2], [40.3, 50.3]])
         assert a[:, 0].tolist() == [17.1, 40.3]
         assert a[0].tolist() == [17.1, 27.2]
 
     def test_concatenate(self):
-        from numpypy import array, concatenate, dtype
+        from numpy import array, concatenate, dtype
         exc = raises(ValueError, concatenate, (array(1.5), array(2.5)))
         assert exc.value[0] == 'zero-dimensional arrays cannot be concatenated'
         a = concatenate((array(1.5), array(2.5)), axis=None)
@@ -1933,7 +1933,7 @@
 
     def test_record_concatenate(self):
         # only an exact match can succeed
-        from numpypy import zeros, concatenate
+        from numpy import zeros, concatenate
         a = concatenate((zeros((2,),dtype=[('x', int), ('y', float)]),
                          zeros((2,),dtype=[('x', int), ('y', float)])))
         assert a.shape == (4,)
@@ -1949,7 +1949,7 @@
         assert str(exc.value).startswith('invalid type promotion')
 
     def test_flatten(self):
-        from numpypy import array
+        from numpy import array
 
         assert array(3).flatten().shape == (1,)
         a = array([[1, 2], [3, 4]])
@@ -1972,7 +1972,7 @@
         assert (a.T.flatten() == [1, 3, 2, 4]).all()
 
     def test_itemsize(self):
-        from numpypy import ones, dtype, array
+        from numpy import ones, dtype, array
 
         for obj in [float, bool, int]:
             assert ones(1, dtype=obj).itemsize == dtype(obj).itemsize
@@ -1981,7 +1981,7 @@
         assert ones(1)[:].itemsize == 8
 
     def test_nbytes(self):
-        from numpypy import array, ones
+        from numpy import array, ones
 
         assert ones(1).nbytes == 8
         assert ones((2, 2)).nbytes == 32
@@ -1990,7 +1990,7 @@
         assert array(3.0).nbytes == 8
 
     def test_repeat(self):
-        from numpypy import array
+        from numpy import array
         a = array([[1, 2], [3, 4]])
         assert (a.repeat(3) == [1, 1, 1, 2, 2, 2,
                                  3, 3, 3, 4, 4, 4]).all()
@@ -2033,7 +2033,7 @@
         assert exc.value.message == "duplicate value in 'axis'"
 
     def test_swapaxes(self):
-        from numpypy import array
+        from numpy import array
         x = array([])
         assert x.swapaxes(0, 2) is x
         x = array([[1, 2]])
@@ -2071,19 +2071,19 @@
         assert array(1).swapaxes(10, 12) == 1
 
     def test_filter_bug(self):
-        from numpypy import array
+        from numpy import array
         a = array([1.0,-1.0])
         a[a<0] = -a[a<0]
         assert (a == [1, 1]).all()
 
     def test_int_list_index(slf):
-        from numpypy import array, arange
+        from numpy import array, arange
         assert (array([10,11,12,13])[[1,2]] == [11, 12]).all()
         assert (arange(6).reshape((2,3))[[0,1]] == [[0, 1, 2], [3, 4, 5]]).all()
         assert arange(6).reshape((2,3))[(0,1)] == 1
 
     def test_int_array_index(self):
-        from numpypy import array, arange, zeros
+        from numpy import array, arange, zeros
         b = arange(10)[array([3, 2, 1, 5])]
         assert (b == [3, 2, 1, 5]).all()
         raises(IndexError, "arange(10)[array([10])]")
@@ -2095,7 +2095,7 @@
         assert (zeros(1)[[]] == []).all()
 
     def test_int_array_index_setitem(self):
-        from numpypy import arange, zeros, array
+        from numpy import arange, zeros, array
         a = arange(10)
         a[[3, 2, 1, 5]] = zeros(4, dtype=int)
         assert (a == [0, 0, 0, 0, 4, 0, 6, 7, 8, 9]).all()
@@ -2109,7 +2109,7 @@
         assert (a == [0, 0, 0, 1, 1, 1, 0, 0, 0, 0]).all()
 
     def test_array_scalar_index(self):
-        import numpypy as np
+        import numpy as np
         a = np.array([[1, 2, 3],
                       [4, 5, 6],
                       [7, 8, 9]])
@@ -2130,7 +2130,7 @@
                                     'integer (or boolean) type'
 
     def test_bool_array_index(self):
-        from numpypy import arange, array
+        from numpy import arange, array
         b = arange(10)
         assert (b[array([True, False, True])] == [0, 2]).all()


More information about the pypy-commit mailing list