summaryrefslogtreecommitdiff
path: root/numpy/lib/tests
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/lib/tests')
-rw-r--r--numpy/lib/tests/test_arraysetops.py16
-rw-r--r--numpy/lib/tests/test_function_base.py25
-rw-r--r--numpy/lib/tests/test_index_tricks.py1
-rw-r--r--numpy/lib/tests/test_polynomial.py2
-rw-r--r--numpy/lib/tests/test_shape_base.py19
-rw-r--r--numpy/lib/tests/test_twodim_base.py4
-rw-r--r--numpy/lib/tests/test_type_check.py1
7 files changed, 32 insertions, 36 deletions
diff --git a/numpy/lib/tests/test_arraysetops.py b/numpy/lib/tests/test_arraysetops.py
index 36b53c8e6..ccdcc7556 100644
--- a/numpy/lib/tests/test_arraysetops.py
+++ b/numpy/lib/tests/test_arraysetops.py
@@ -21,7 +21,7 @@ class test_aso(NumpyTestCase):
ec = numpy.array( [1, 2, 5, 7] )
c = unique1d( a )
assert_array_equal( c, ec )
-
+
assert_array_equal([], unique1d([]))
##
@@ -34,7 +34,7 @@ class test_aso(NumpyTestCase):
ec = numpy.array( [1, 2, 5] )
c = intersect1d( a, b )
assert_array_equal( c, ec )
-
+
assert_array_equal([], intersect1d([],[]))
##
@@ -47,7 +47,7 @@ class test_aso(NumpyTestCase):
ec = numpy.array( [1, 2, 5] )
c = intersect1d_nu( a, b )
assert_array_equal( c, ec )
-
+
assert_array_equal([], intersect1d_nu([],[]))
##
@@ -74,14 +74,14 @@ class test_aso(NumpyTestCase):
ec = numpy.array( [1, 2, 3, 4, 5, 6] )
c = setxor1d( a, b )
assert_array_equal( c, ec )
-
+
assert_array_equal([], setxor1d([],[]))
def check_ediff1d(self):
zero_elem = numpy.array([])
one_elem = numpy.array([1])
two_elem = numpy.array([1,2])
-
+
assert_array_equal([],ediff1d(zero_elem))
assert_array_equal([0],ediff1d(zero_elem,to_begin=0))
assert_array_equal([0],ediff1d(zero_elem,to_end=0))
@@ -109,7 +109,7 @@ class test_aso(NumpyTestCase):
ec = numpy.array( [True, False, True, False] )
c = setmember1d( a, b )
assert_array_equal( c, ec )
-
+
assert_array_equal([], setmember1d([],[]))
##
@@ -122,7 +122,7 @@ class test_aso(NumpyTestCase):
ec = numpy.array( [1, 2, 3, 4, 5, 7] )
c = union1d( a, b )
assert_array_equal( c, ec )
-
+
assert_array_equal([], union1d([],[]))
##
@@ -142,7 +142,7 @@ class test_aso(NumpyTestCase):
ec = numpy.array( [19, 20] )
c = setdiff1d( a, b )
assert_array_equal( c, ec )
-
+
assert_array_equal([], setdiff1d([],[]))
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py
index c3eaa9dd2..58f73ec5f 100644
--- a/numpy/lib/tests/test_function_base.py
+++ b/numpy/lib/tests/test_function_base.py
@@ -1,4 +1,3 @@
-
import sys
from numpy.testing import *
@@ -93,7 +92,7 @@ class test_linspace(NumpyTestCase):
t3 = linspace(0,1,2).dtype
assert_equal(t1, t2)
assert_equal(t2, t3)
-
+
class test_insert(NumpyTestCase):
def check_basic(self):
a = [1,2,3]
@@ -276,23 +275,23 @@ class test_vectorize(NumpyTestCase):
f = vectorize(addsubtract)
r = f([0,3,6,9],5)
assert_array_equal(r,[5,8,1,4])
- def check_large(self):
- x = linspace(-3,2,10000)
- f = vectorize(lambda x: x)
- y = f(x)
- assert_array_equal(y, x)
+ def check_large(self):
+ x = linspace(-3,2,10000)
+ f = vectorize(lambda x: x)
+ y = f(x)
+ assert_array_equal(y, x)
class test_digitize(NumpyTestCase):
def check_forward(self):
x = arange(-6,5)
bins = arange(-5,5)
assert_array_equal(digitize(x,bins),arange(11))
-
+
def check_reverse(self):
x = arange(5,-6,-1)
bins = arange(5,-5,-1)
assert_array_equal(digitize(x,bins),arange(11))
-
+
def check_random(self):
x = rand(10)
bin = linspace(x.min(), x.max(), 10)
@@ -378,12 +377,12 @@ class test_histogramdd(NumpyTestCase):
# Check that a sequence of arrays is accepted and H has the correct shape.
z = [squeeze(y) for y in split(x,3,axis=1)]
H, edges = histogramdd(z, bins=(4,3,2),range=[[-2,2], [0,3], [0,2]])
- answer = asarray([[[0,0],[0,0],[0,0]],
- [[0,1], [0,0], [1,0]],
- [[0,1], [0,0],[0,0]],
+ answer = asarray([[[0,0],[0,0],[0,0]],
+ [[0,1], [0,0], [1,0]],
+ [[0,1], [0,0],[0,0]],
[[0,0],[0,0],[0,0]]])
assert_array_equal(H, answer)
-
+
class test_unique(NumpyTestCase):
def check_simple(self):
diff --git a/numpy/lib/tests/test_index_tricks.py b/numpy/lib/tests/test_index_tricks.py
index f7797396f..5d4f540b2 100644
--- a/numpy/lib/tests/test_index_tricks.py
+++ b/numpy/lib/tests/test_index_tricks.py
@@ -1,4 +1,3 @@
-
from numpy.testing import *
set_package_path()
from numpy import array, ones, r_, mgrid
diff --git a/numpy/lib/tests/test_polynomial.py b/numpy/lib/tests/test_polynomial.py
index e2afc72ae..f3a8720d9 100644
--- a/numpy/lib/tests/test_polynomial.py
+++ b/numpy/lib/tests/test_polynomial.py
@@ -78,7 +78,7 @@ import numpy as N
class test_docs(NumpyTestCase):
def check_doctests(self): return self.rundocs()
-
+
def check_roots(self):
assert_array_equal(N.roots([1,0,0]), [0,0])
diff --git a/numpy/lib/tests/test_shape_base.py b/numpy/lib/tests/test_shape_base.py
index 416c2644f..a96b4fc2c 100644
--- a/numpy/lib/tests/test_shape_base.py
+++ b/numpy/lib/tests/test_shape_base.py
@@ -1,4 +1,3 @@
-
from numpy.testing import *
set_package_path()
import numpy.lib;
@@ -360,17 +359,17 @@ class test_kron(NumpyTestCase):
def check_return_type(self):
a = ones([2,2])
m = asmatrix(a)
- assert_equal(type(kron(a,a)), ndarray)
- assert_equal(type(kron(m,m)), matrix)
- assert_equal(type(kron(a,m)), matrix)
- assert_equal(type(kron(m,a)), matrix)
- class myarray(ndarray):
+ assert_equal(type(kron(a,a)), ndarray)
+ assert_equal(type(kron(m,m)), matrix)
+ assert_equal(type(kron(a,m)), matrix)
+ assert_equal(type(kron(m,a)), matrix)
+ class myarray(ndarray):
__array_priority__ = 0.0
ma = myarray(a.shape, a.dtype, a.data)
- assert_equal(type(kron(a,a)), ndarray)
- assert_equal(type(kron(ma,ma)), myarray)
- assert_equal(type(kron(a,ma)), ndarray)
- assert_equal(type(kron(ma,a)), myarray)
+ assert_equal(type(kron(a,a)), ndarray)
+ assert_equal(type(kron(ma,ma)), myarray)
+ assert_equal(type(kron(a,ma)), ndarray)
+ assert_equal(type(kron(ma,a)), myarray)
class test_tile(NumpyTestCase):
diff --git a/numpy/lib/tests/test_twodim_base.py b/numpy/lib/tests/test_twodim_base.py
index 3c6edfd24..7ef8a94e9 100644
--- a/numpy/lib/tests/test_twodim_base.py
+++ b/numpy/lib/tests/test_twodim_base.py
@@ -162,12 +162,12 @@ class test_histogram2d(NumpyTestCase):
assert_array_almost_equal(H, answer/8., 3)
def check_norm(self):
x = array([1,2,3,1,2,3,1,2,3])
- y = array([1,1,1,2,2,2,3,3,3])
+ y = array([1,1,1,2,2,2,3,3,3])
H, xed, yed = histogram2d(x,y,[[1,2,3,5], [1,2,3,5]], normed=True)
answer=array([[1,1,.5],
[1,1,.5],
[.5,.5,.25]])/9.
assert_array_almost_equal(H, answer, 3)
-
+
if __name__ == "__main__":
NumpyTest().run()
diff --git a/numpy/lib/tests/test_type_check.py b/numpy/lib/tests/test_type_check.py
index dd9678302..8b990c57e 100644
--- a/numpy/lib/tests/test_type_check.py
+++ b/numpy/lib/tests/test_type_check.py
@@ -1,4 +1,3 @@
-
import sys
from numpy.testing import *