[pypy-commit] pypy default: rename numpy -> numpypy
fijal
noreply at buildbot.pypy.org
Fri Nov 18 10:26:44 CET 2011
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch:
Changeset: r49515:f732c0996244
Date: 2011-11-18 11:26 +0200
http://bitbucket.org/pypy/pypy/changeset/f732c0996244/
Log: rename numpy -> numpypy
diff --git a/pypy/module/micronumpy/__init__.py b/pypy/module/micronumpy/__init__.py
--- a/pypy/module/micronumpy/__init__.py
+++ b/pypy/module/micronumpy/__init__.py
@@ -2,7 +2,7 @@
class Module(MixedModule):
- applevel_name = 'numpy'
+ applevel_name = 'numpypy'
interpleveldefs = {
'array': 'interp_numarray.SingleDimArray',
diff --git a/pypy/module/micronumpy/app_numpy.py b/pypy/module/micronumpy/app_numpy.py
--- a/pypy/module/micronumpy/app_numpy.py
+++ b/pypy/module/micronumpy/app_numpy.py
@@ -1,6 +1,6 @@
import math
-import numpy
+import numpypy
inf = float("inf")
@@ -13,5 +13,5 @@
def mean(a):
if not hasattr(a, "mean"):
- a = numpy.array(a)
+ a = numpypy.array(a)
return a.mean()
diff --git a/pypy/module/micronumpy/bench/add.py b/pypy/module/micronumpy/bench/add.py
--- a/pypy/module/micronumpy/bench/add.py
+++ b/pypy/module/micronumpy/bench/add.py
@@ -1,5 +1,8 @@
-import numpy
+try:
+ import numpypy as numpy
+except:
+ import numpy
def f():
a = numpy.zeros(10000000)
diff --git a/pypy/module/micronumpy/bench/iterate.py b/pypy/module/micronumpy/bench/iterate.py
--- a/pypy/module/micronumpy/bench/iterate.py
+++ b/pypy/module/micronumpy/bench/iterate.py
@@ -1,5 +1,8 @@
-import numpy
+try:
+ import numpypy as numpy
+except:
+ import numpy
def f():
sum = 0
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
@@ -3,7 +3,7 @@
class AppTestDtypes(BaseNumpyAppTest):
def test_dtype(self):
- from numpy import dtype
+ from numpypy import dtype
d = dtype('?')
assert d.num == 0
@@ -14,7 +14,7 @@
raises(TypeError, dtype, 1042)
def test_dtype_with_types(self):
- from numpy import dtype
+ from numpypy import dtype
assert dtype(bool).num == 0
assert dtype(int).num == 7
@@ -22,13 +22,13 @@
assert dtype(float).num == 12
def test_array_dtype_attr(self):
- from numpy import array, dtype
+ from numpypy import array, dtype
a = array(range(5), long)
assert a.dtype is dtype(long)
def test_repr_str(self):
- from numpy import dtype
+ from numpypy import dtype
assert repr(dtype) == "<type 'numpy.dtype'>"
d = dtype('?')
@@ -36,57 +36,57 @@
assert str(d) == "bool"
def test_bool_array(self):
- import numpy
+ from numpypy import array, False_, True_
- a = numpy.array([0, 1, 2, 2.5], dtype='?')
- assert a[0] is numpy.False_
+ a = array([0, 1, 2, 2.5], dtype='?')
+ assert a[0] is False_
for i in xrange(1, 4):
- assert a[i] is numpy.True_
+ assert a[i] is True_
def test_copy_array_with_dtype(self):
- import numpy
+ from numpypy import array, False_, True_
- a = numpy.array([0, 1, 2, 3], dtype=long)
+ a = array([0, 1, 2, 3], dtype=long)
# int on 64-bit, long in 32-bit
assert isinstance(a[0], (int, long))
b = a.copy()
assert isinstance(b[0], (int, long))
- a = numpy.array([0, 1, 2, 3], dtype=bool)
- assert a[0] is numpy.False_
+ a = array([0, 1, 2, 3], dtype=bool)
+ assert a[0] is False_
b = a.copy()
- assert b[0] is numpy.False_
+ assert b[0] is False_
def test_zeros_bool(self):
- import numpy
+ from numpypy import zeros, False_
- a = numpy.zeros(10, dtype=bool)
+ a = zeros(10, dtype=bool)
for i in range(10):
- assert a[i] is numpy.False_
+ assert a[i] is False_
def test_ones_bool(self):
- import numpy
+ from numpypy import ones, True_
- a = numpy.ones(10, dtype=bool)
+ a = ones(10, dtype=bool)
for i in range(10):
- assert a[i] is numpy.True_
+ assert a[i] is True_
def test_zeros_long(self):
- from numpy import zeros
+ from numpypy import zeros
a = zeros(10, dtype=long)
for i in range(10):
assert isinstance(a[i], (int, long))
assert a[1] == 0
def test_ones_long(self):
- from numpy import ones
+ from numpypy import ones
a = ones(10, dtype=long)
for i in range(10):
assert isinstance(a[i], (int, long))
assert a[1] == 1
def test_overflow(self):
- from numpy import array, dtype
+ from numpypy import array, dtype
assert array([128], 'b')[0] == -128
assert array([256], 'B')[0] == 0
assert array([32768], 'h')[0] == -32768
@@ -98,7 +98,7 @@
raises(OverflowError, "array([2**64], 'Q')")
def test_bool_binop_types(self):
- from numpy import array, dtype
+ from numpypy import array, dtype
types = [
'?', 'b', 'B', 'h', 'H', 'i', 'I', 'l', 'L', 'q', 'Q', 'f', 'd'
]
@@ -107,7 +107,7 @@
assert (a + array([0], t)).dtype is dtype(t)
def test_binop_types(self):
- from numpy import array, dtype
+ from numpypy 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'),
@@ -129,7 +129,7 @@
assert (array([1], d1) + array([1], d2)).dtype is dtype(dout)
def test_add_int8(self):
- from numpy import array, dtype
+ from numpypy import array, dtype
a = array(range(5), dtype="int8")
b = a + a
@@ -138,7 +138,7 @@
assert b[i] == i * 2
def test_add_int16(self):
- from numpy import array, dtype
+ from numpypy import array, dtype
a = array(range(5), dtype="int16")
b = a + a
@@ -147,7 +147,7 @@
assert b[i] == i * 2
def test_add_uint32(self):
- from numpy import array, dtype
+ from numpypy import array, dtype
a = array(range(5), dtype="I")
b = a + a
@@ -156,12 +156,12 @@
assert b[i] == i * 2
def test_shape(self):
- from numpy import dtype
+ from numpypy import dtype
assert dtype(long).shape == ()
def test_cant_subclass(self):
- from numpy import dtype
+ from numpypy import dtype
# You can't subclass dtype
raises(TypeError, type, "Foo", (dtype,), {})
diff --git a/pypy/module/micronumpy/test/test_module.py b/pypy/module/micronumpy/test/test_module.py
--- a/pypy/module/micronumpy/test/test_module.py
+++ b/pypy/module/micronumpy/test/test_module.py
@@ -3,19 +3,19 @@
class AppTestNumPyModule(BaseNumpyAppTest):
def test_mean(self):
- from numpy import array, mean
+ from numpypy import array, mean
assert mean(array(range(5))) == 2.0
assert mean(range(5)) == 2.0
def test_average(self):
- from numpy import array, average
+ from numpypy import array, average
assert average(range(10)) == 4.5
assert average(array(range(10))) == 4.5
def test_constants(self):
import math
- from numpy import inf, e
+ from numpypy import inf, e
assert type(inf) is float
assert inf == float("inf")
assert e == math.e
- assert type(e) is float
\ No newline at end of file
+ assert type(e) is float
diff --git a/pypy/module/micronumpy/test/test_numarray.py b/pypy/module/micronumpy/test/test_numarray.py
--- a/pypy/module/micronumpy/test/test_numarray.py
+++ b/pypy/module/micronumpy/test/test_numarray.py
@@ -4,12 +4,12 @@
class AppTestNumArray(BaseNumpyAppTest):
def test_type(self):
- from numpy import array
+ from numpypy import array
ar = array(range(5))
assert type(ar) is type(ar + ar)
def test_init(self):
- from numpy import zeros
+ from numpypy import zeros
a = zeros(15)
# Check that storage was actually zero'd.
assert a[10] == 0.0
@@ -18,7 +18,7 @@
assert a[13] == 5.3
def test_size(self):
- from numpy import array
+ from numpypy import array
# XXX fixed on multidim branch
#assert array(3).size == 1
a = array([1, 2, 3])
@@ -30,13 +30,13 @@
Test that empty() works.
"""
- from numpy import empty
+ from numpypy import empty
a = empty(2)
a[1] = 1.0
assert a[1] == 1.0
def test_ones(self):
- from numpy import ones
+ from numpypy import ones
a = ones(3)
assert len(a) == 3
assert a[0] == 1
@@ -45,19 +45,19 @@
assert a[2] == 4
def test_copy(self):
- from numpy import array
+ from numpypy import array
a = array(range(5))
b = a.copy()
for i in xrange(5):
assert b[i] == a[i]
def test_iterator_init(self):
- from numpy import array
+ from numpypy import array
a = array(range(5))
assert a[3] == 3
def test_repr(self):
- from numpy import array, zeros
+ from numpypy import array, zeros
a = array(range(5), float)
assert repr(a) == "array([0.0, 1.0, 2.0, 3.0, 4.0])"
a = array([], float)
@@ -72,7 +72,7 @@
assert repr(a) == "array([True, False, True, False], dtype=bool)"
def test_repr_slice(self):
- from numpy import array, zeros
+ from numpypy import array, zeros
a = array(range(5), float)
b = a[1::2]
assert repr(b) == "array([1.0, 3.0])"
@@ -81,7 +81,7 @@
assert repr(b) == "array([0.0, 0.0, 0.0, ..., 0.0, 0.0, 0.0])"
def test_str(self):
- from numpy import array, zeros
+ from numpypy import array, zeros
a = array(range(5), float)
assert str(a) == "[0.0 1.0 2.0 3.0 4.0]"
assert str((2*a)[:]) == "[0.0 2.0 4.0 6.0 8.0]"
@@ -100,7 +100,7 @@
assert str(a) == "[0 1 2 3 4]"
def test_str_slice(self):
- from numpy import array, zeros
+ from numpypy import array, zeros
a = array(range(5), float)
b = a[1::2]
assert str(b) == "[1.0 3.0]"
@@ -109,7 +109,7 @@
assert str(b) == "[0.0 0.0 0.0 ..., 0.0 0.0 0.0]"
def test_getitem(self):
- from numpy import array
+ from numpypy import array
a = array(range(5))
raises(IndexError, "a[5]")
a = a + a
@@ -118,7 +118,7 @@
raises(IndexError, "a[-6]")
def test_getitem_tuple(self):
- from numpy import array
+ from numpypy import array
a = array(range(5))
raises(IndexError, "a[(1,2)]")
for i in xrange(5):
@@ -128,7 +128,7 @@
assert a[i] == b[i]
def test_setitem(self):
- from numpy import array
+ from numpypy import array
a = array(range(5))
a[-1] = 5.0
assert a[4] == 5.0
@@ -136,7 +136,7 @@
raises(IndexError, "a[-6] = 3.0")
def test_setitem_tuple(self):
- from numpy import array
+ from numpypy import array
a = array(range(5))
raises(IndexError, "a[(1,2)] = [0,1]")
for i in xrange(5):
@@ -147,7 +147,7 @@
assert a[i] == i
def test_setslice_array(self):
- from numpy import array
+ from numpypy import array
a = array(range(5))
b = array(range(2))
a[1:4:2] = b
@@ -158,7 +158,7 @@
assert b[1] == 0.
def test_setslice_of_slice_array(self):
- from numpy import array, zeros
+ from numpypy import array, zeros
a = zeros(5)
a[::2] = array([9., 10., 11.])
assert a[0] == 9.
@@ -177,7 +177,7 @@
assert a[0] == 3.
def test_setslice_list(self):
- from numpy import array
+ from numpypy import array
a = array(range(5), float)
b = [0., 1.]
a[1:4:2] = b
@@ -185,20 +185,20 @@
assert a[3] == 1.
def test_setslice_constant(self):
- from numpy import array
+ from numpypy import array
a = array(range(5), float)
a[1:4:2] = 0.
assert a[1] == 0.
assert a[3] == 0.
def test_len(self):
- from numpy import array
+ from numpypy import array
a = array(range(5))
assert len(a) == 5
assert len(a + a) == 5
def test_shape(self):
- from numpy import array
+ from numpypy import array
a = array(range(5))
assert a.shape == (5,)
b = a + a
@@ -207,7 +207,7 @@
assert c.shape == (3,)
def test_add(self):
- from numpy import array
+ from numpypy import array
a = array(range(5))
b = a + a
for i in range(5):
@@ -220,7 +220,7 @@
assert c[i] == bool(a[i] + b[i])
def test_add_other(self):
- from numpy import array
+ from numpypy import array
a = array(range(5))
b = array(range(4, -1, -1))
c = a + b
@@ -228,20 +228,20 @@
assert c[i] == 4
def test_add_constant(self):
- from numpy import array
+ from numpypy import array
a = array(range(5))
b = a + 5
for i in range(5):
assert b[i] == i + 5
def test_radd(self):
- from numpy import array
+ from numpypy import array
r = 3 + array(range(3))
for i in range(3):
assert r[i] == i + 3
def test_add_list(self):
- from numpy import array
+ from numpypy import array
a = array(range(5))
b = list(reversed(range(5)))
c = a + b
@@ -250,14 +250,14 @@
assert c[i] == 4
def test_subtract(self):
- from numpy import array
+ from numpypy import array
a = array(range(5))
b = a - a
for i in range(5):
assert b[i] == 0
def test_subtract_other(self):
- from numpy import array
+ from numpypy import array
a = array(range(5))
b = array([1, 1, 1, 1, 1])
c = a - b
@@ -265,29 +265,29 @@
assert c[i] == i - 1
def test_subtract_constant(self):
- from numpy import array
+ from numpypy import array
a = array(range(5))
b = a - 5
for i in range(5):
assert b[i] == i - 5
def test_mul(self):
- import numpy
+ import numpypy
- a = numpy.array(range(5))
+ a = numpypy.array(range(5))
b = a * a
for i in range(5):
assert b[i] == i * i
- a = numpy.array(range(5), dtype=bool)
+ a = numpypy.array(range(5), dtype=bool)
b = a * a
- assert b.dtype is numpy.dtype(bool)
- assert b[0] is numpy.False_
+ assert b.dtype is numpypy.dtype(bool)
+ assert b[0] is numpypy.False_
for i in range(1, 5):
- assert b[i] is numpy.True_
+ assert b[i] is numpypy.True_
def test_mul_constant(self):
- from numpy import array
+ from numpypy import array
a = array(range(5))
b = a * 5
for i in range(5):
@@ -295,7 +295,7 @@
def test_div(self):
from math import isnan
- from numpy import array, dtype, inf
+ from numpypy import array, dtype, inf
a = array(range(1, 6))
b = a / a
@@ -327,7 +327,7 @@
assert c[2] == -inf
def test_div_other(self):
- from numpy import array
+ from numpypy import array
a = array(range(5))
b = array([2, 2, 2, 2, 2], float)
c = a / b
@@ -335,14 +335,14 @@
assert c[i] == i / 2.0
def test_div_constant(self):
- from numpy import array
+ from numpypy import array
a = array(range(5))
b = a / 5.0
for i in range(5):
assert b[i] == i / 5.0
def test_pow(self):
- from numpy import array
+ from numpypy import array
a = array(range(5), float)
b = a ** a
for i in range(5):
@@ -350,7 +350,7 @@
assert b[i] == i**i
def test_pow_other(self):
- from numpy import array
+ from numpypy import array
a = array(range(5), float)
b = array([2, 2, 2, 2, 2])
c = a ** b
@@ -358,14 +358,14 @@
assert c[i] == i ** 2
def test_pow_constant(self):
- from numpy import array
+ from numpypy 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 numpy import array
+ from numpypy import array
a = array(range(1,6))
b = a % a
for i in range(5):
@@ -378,7 +378,7 @@
assert b[i] == 1
def test_mod_other(self):
- from numpy import array
+ from numpypy import array
a = array(range(5))
b = array([2, 2, 2, 2, 2])
c = a % b
@@ -386,14 +386,14 @@
assert c[i] == i % 2
def test_mod_constant(self):
- from numpy import array
+ from numpypy import array
a = array(range(5))
b = a % 2
for i in range(5):
assert b[i] == i % 2
def test_pos(self):
- from numpy import array
+ from numpypy import array
a = array([1.,-2.,3.,-4.,-5.])
b = +a
for i in range(5):
@@ -404,7 +404,7 @@
assert a[i] == i
def test_neg(self):
- from numpy import array
+ from numpypy import array
a = array([1.,-2.,3.,-4.,-5.])
b = -a
for i in range(5):
@@ -415,7 +415,7 @@
assert a[i] == -i
def test_abs(self):
- from numpy import array
+ from numpypy import array
a = array([1.,-2.,3.,-4.,-5.])
b = abs(a)
for i in range(5):
@@ -426,7 +426,7 @@
assert a[i + 5] == abs(i)
def test_auto_force(self):
- from numpy import array
+ from numpypy import array
a = array(range(5))
b = a - 1
a[2] = 3
@@ -440,7 +440,7 @@
assert c[1] == 4
def test_getslice(self):
- from numpy import array
+ from numpypy import array
a = array(range(5))
s = a[1:5]
assert len(s) == 4
@@ -454,7 +454,7 @@
assert s[0] == 5
def test_getslice_step(self):
- from numpy import array
+ from numpypy import array
a = array(range(10))
s = a[1:9:2]
assert len(s) == 4
@@ -462,7 +462,7 @@
assert s[i] == a[2*i+1]
def test_slice_update(self):
- from numpy import array
+ from numpypy import array
a = array(range(5))
s = a[0:3]
s[1] = 10
@@ -473,7 +473,7 @@
def test_slice_invaidate(self):
# check that slice shares invalidation list with
- from numpy import array
+ from numpypy import array
a = array(range(5))
s = a[0:2]
b = array([10,11])
@@ -487,13 +487,13 @@
assert d[1] == 12
def test_mean(self):
- from numpy import array
+ from numpypy import array
a = array(range(5))
assert a.mean() == 2.0
assert a[:4].mean() == 1.5
def test_sum(self):
- from numpy import array
+ from numpypy import array
a = array(range(5))
assert a.sum() == 10.0
assert a[:4].sum() == 6.0
@@ -502,32 +502,32 @@
assert a.sum() == 5
def test_prod(self):
- from numpy import array
+ from numpypy import array
a = array(range(1,6))
assert a.prod() == 120.0
assert a[:4].prod() == 24.0
def test_max(self):
- from numpy import array
+ from numpypy import array
a = array([-1.2, 3.4, 5.7, -3.0, 2.7])
assert a.max() == 5.7
b = array([])
raises(ValueError, "b.max()")
def test_max_add(self):
- from numpy import array
+ from numpypy 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 numpy import array
+ from numpypy import array
a = array([-1.2, 3.4, 5.7, -3.0, 2.7])
assert a.min() == -3.0
b = array([])
raises(ValueError, "b.min()")
def test_argmax(self):
- from numpy import array
+ from numpypy import array
a = array([-1.2, 3.4, 5.7, -3.0, 2.7])
assert a.argmax() == 2
b = array([])
@@ -537,14 +537,14 @@
assert a.argmax() == 9
def test_argmin(self):
- from numpy import array
+ from numpypy import array
a = array([-1.2, 3.4, 5.7, -3.0, 2.7])
assert a.argmin() == 3
b = array([])
raises(ValueError, "b.argmin()")
def test_all(self):
- from numpy import array
+ from numpypy import array
a = array(range(5))
assert a.all() == False
a[0] = 3.0
@@ -553,7 +553,7 @@
assert b.all() == True
def test_any(self):
- from numpy import array, zeros
+ from numpypy import array, zeros
a = array(range(5))
assert a.any() == True
b = zeros(5)
@@ -562,7 +562,7 @@
assert c.any() == False
def test_dot(self):
- from numpy import array
+ from numpypy import array
a = array(range(5))
assert a.dot(a) == 30.0
@@ -570,14 +570,14 @@
assert a.dot(range(5)) == 30
def test_dot_constant(self):
- from numpy import array
+ from numpypy import array
a = array(range(5))
b = a.dot(2.5)
for i in xrange(5):
assert b[i] == 2.5 * a[i]
def test_dtype_guessing(self):
- from numpy import array, dtype
+ from numpypy import array, dtype
assert array([True]).dtype is dtype(bool)
assert array([True, False]).dtype is dtype(bool)
@@ -590,7 +590,7 @@
def test_comparison(self):
import operator
- from numpy import array, dtype
+ from numpypy import array, dtype
a = array(range(5))
b = array(range(5), float)
@@ -616,7 +616,7 @@
cls.w_data = cls.space.wrap(struct.pack('dddd', 1, 2, 3, 4))
def test_fromstring(self):
- from numpy import fromstring
+ from numpypy import fromstring
a = fromstring(self.data)
for i in range(4):
assert a[i] == i + 1
diff --git a/pypy/module/micronumpy/test/test_ufuncs.py b/pypy/module/micronumpy/test/test_ufuncs.py
--- a/pypy/module/micronumpy/test/test_ufuncs.py
+++ b/pypy/module/micronumpy/test/test_ufuncs.py
@@ -4,14 +4,14 @@
class AppTestUfuncs(BaseNumpyAppTest):
def test_ufunc_instance(self):
- from numpy import add, ufunc
+ from numpypy import add, ufunc
assert isinstance(add, ufunc)
assert repr(add) == "<ufunc 'add'>"
assert repr(ufunc) == "<type 'numpy.ufunc'>"
def test_ufunc_attrs(self):
- from numpy import add, multiply, sin
+ from numpypy import add, multiply, sin
assert add.identity == 0
assert multiply.identity == 1
@@ -22,7 +22,7 @@
assert sin.nin == 1
def test_wrong_arguments(self):
- from numpy import add, sin
+ from numpypy import add, sin
raises(ValueError, add, 1)
raises(TypeError, add, 1, 2, 3)
@@ -30,14 +30,14 @@
raises(ValueError, sin)
def test_single_item(self):
- from numpy import negative, sign, minimum
+ from numpypy import negative, sign, minimum
assert negative(5.0) == -5.0
assert sign(-0.0) == 0.0
assert minimum(2.0, 3.0) == 2.0
def test_sequence(self):
- from numpy import array, negative, minimum
+ from numpypy import array, negative, minimum
a = array(range(3))
b = [2.0, 1.0, 0.0]
c = 1.0
@@ -71,7 +71,7 @@
assert min_c_b[i] == min(b[i], c)
def test_negative(self):
- from numpy import array, negative
+ from numpypy import array, negative
a = array([-5.0, 0.0, 1.0])
b = negative(a)
@@ -86,7 +86,7 @@
assert negative(a + a)[3] == -6
def test_abs(self):
- from numpy import array, absolute
+ from numpypy import array, absolute
a = array([-5.0, -0.0, 1.0])
b = absolute(a)
@@ -94,7 +94,7 @@
assert b[i] == abs(a[i])
def test_add(self):
- from numpy import array, add
+ from numpypy import array, add
a = array([-5.0, -0.0, 1.0])
b = array([ 3.0, -2.0,-3.0])
@@ -103,7 +103,7 @@
assert c[i] == a[i] + b[i]
def test_divide(self):
- from numpy import array, divide
+ from numpypy import array, divide
a = array([-5.0, -0.0, 1.0])
b = array([ 3.0, -2.0,-3.0])
@@ -112,7 +112,7 @@
assert c[i] == a[i] / b[i]
def test_fabs(self):
- from numpy import array, fabs
+ from numpypy import array, fabs
from math import fabs as math_fabs
a = array([-5.0, -0.0, 1.0])
@@ -121,7 +121,7 @@
assert b[i] == math_fabs(a[i])
def test_minimum(self):
- from numpy import array, minimum
+ from numpypy import array, minimum
a = array([-5.0, -0.0, 1.0])
b = array([ 3.0, -2.0,-3.0])
@@ -130,7 +130,7 @@
assert c[i] == min(a[i], b[i])
def test_maximum(self):
- from numpy import array, maximum
+ from numpypy import array, maximum
a = array([-5.0, -0.0, 1.0])
b = array([ 3.0, -2.0,-3.0])
@@ -143,7 +143,7 @@
assert isinstance(x, (int, long))
def test_multiply(self):
- from numpy import array, multiply
+ from numpypy import array, multiply
a = array([-5.0, -0.0, 1.0])
b = array([ 3.0, -2.0,-3.0])
@@ -152,7 +152,7 @@
assert c[i] == a[i] * b[i]
def test_sign(self):
- from numpy import array, sign, dtype
+ from numpypy import array, sign, dtype
reference = [-1.0, 0.0, 0.0, 1.0]
a = array([-5.0, -0.0, 0.0, 6.0])
@@ -171,7 +171,7 @@
assert a[1] == 0
def test_reciporocal(self):
- from numpy import array, reciprocal
+ from numpypy import array, reciprocal
reference = [-0.2, float("inf"), float("-inf"), 2.0]
a = array([-5.0, 0.0, -0.0, 0.5])
@@ -180,7 +180,7 @@
assert b[i] == reference[i]
def test_subtract(self):
- from numpy import array, subtract
+ from numpypy import array, subtract
a = array([-5.0, -0.0, 1.0])
b = array([ 3.0, -2.0,-3.0])
@@ -189,7 +189,7 @@
assert c[i] == a[i] - b[i]
def test_floor(self):
- from numpy import array, floor
+ from numpypy import array, floor
reference = [-2.0, -1.0, 0.0, 1.0, 1.0]
a = array([-1.4, -1.0, 0.0, 1.0, 1.4])
@@ -198,7 +198,7 @@
assert b[i] == reference[i]
def test_copysign(self):
- from numpy import array, copysign
+ from numpypy import array, copysign
reference = [5.0, -0.0, 0.0, -6.0]
a = array([-5.0, 0.0, 0.0, 6.0])
@@ -214,7 +214,7 @@
def test_exp(self):
import math
- from numpy import array, exp
+ from numpypy import array, exp
a = array([-5.0, -0.0, 0.0, 12345678.0, float("inf"),
-float('inf'), -12343424.0])
@@ -228,7 +228,7 @@
def test_sin(self):
import math
- from numpy import array, sin
+ from numpypy import array, sin
a = array([0, 1, 2, 3, math.pi, math.pi*1.5, math.pi*2])
b = sin(a)
@@ -241,7 +241,7 @@
def test_cos(self):
import math
- from numpy import array, cos
+ from numpypy import array, cos
a = array([0, 1, 2, 3, math.pi, math.pi*1.5, math.pi*2])
b = cos(a)
@@ -250,7 +250,7 @@
def test_tan(self):
import math
- from numpy import array, tan
+ from numpypy import array, tan
a = array([0, 1, 2, 3, math.pi, math.pi*1.5, math.pi*2])
b = tan(a)
@@ -260,7 +260,7 @@
def test_arcsin(self):
import math
- from numpy import array, arcsin
+ from numpypy import array, arcsin
a = array([-1, -0.5, -0.33, 0, 0.33, 0.5, 1])
b = arcsin(a)
@@ -274,7 +274,7 @@
def test_arccos(self):
import math
- from numpy import array, arccos
+ from numpypy import array, arccos
a = array([-1, -0.5, -0.33, 0, 0.33, 0.5, 1])
b = arccos(a)
@@ -289,7 +289,7 @@
def test_arctan(self):
import math
- from numpy import array, arctan
+ from numpypy import array, arctan
a = array([-3, -2, -1, 0, 1, 2, 3, float('inf'), float('-inf')])
b = arctan(a)
@@ -302,7 +302,7 @@
def test_arcsinh(self):
import math
- from numpy import arcsinh, inf
+ from numpypy import arcsinh, inf
for v in [inf, -inf, 1.0, math.e]:
assert math.asinh(v) == arcsinh(v)
@@ -310,7 +310,7 @@
def test_arctanh(self):
import math
- from numpy import arctanh
+ from numpypy import arctanh
for v in [.99, .5, 0, -.5, -.99]:
assert math.atanh(v) == arctanh(v)
@@ -320,13 +320,13 @@
assert arctanh(v) == math.copysign(float("inf"), v)
def test_reduce_errors(self):
- from numpy import sin, add
+ from numpypy import sin, add
raises(ValueError, sin.reduce, [1, 2, 3])
raises(TypeError, add.reduce, 1)
def test_reduce(self):
- from numpy import add, maximum
+ from numpypy import add, maximum
assert add.reduce([1, 2, 3]) == 6
assert maximum.reduce([1]) == 1
@@ -335,7 +335,7 @@
def test_comparisons(self):
import operator
- from numpy import equal, not_equal, less, less_equal, greater, greater_equal
+ from numpypy import equal, not_equal, less, less_equal, greater, greater_equal
for ufunc, func in [
(equal, operator.eq),
More information about the pypy-commit
mailing list