summaryrefslogtreecommitdiff
path: root/numpy/lib/tests
diff options
context:
space:
mode:
authorDavid Cournapeau <cournape@gmail.com>2009-09-16 07:13:23 +0000
committerDavid Cournapeau <cournape@gmail.com>2009-09-16 07:13:23 +0000
commitf72c2dfd7d188f1ee9d795ba66c001aa7263c319 (patch)
treeacb0dac165305a66ed77e682ebedfb6ac6cb0c6a /numpy/lib/tests
parenta0a2b2bba65baaa1ab88fef3995911c14adaf2d4 (diff)
downloadnumpy-f72c2dfd7d188f1ee9d795ba66c001aa7263c319.tar.gz
Move linspace and logspace into core.
Diffstat (limited to 'numpy/lib/tests')
-rw-r--r--numpy/lib/tests/test_function_base.py36
-rw-r--r--numpy/lib/tests/test_index_tricks.py5
2 files changed, 5 insertions, 36 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py
index cfb316074..8595c6b5c 100644
--- a/numpy/lib/tests/test_function_base.py
+++ b/numpy/lib/tests/test_function_base.py
@@ -134,42 +134,6 @@ class TestSelect(TestCase):
assert_equal(len(choices),3)
assert_equal(len(conditions),3)
-class TestLogspace(TestCase):
- def test_basic(self):
- y = logspace(0,6)
- assert(len(y)==50)
- y = logspace(0,6,num=100)
- assert(y[-1] == 10**6)
- y = logspace(0,6,endpoint=0)
- assert(y[-1] < 10**6)
- y = logspace(0,6,num=7)
- assert_array_equal(y,[1,10,100,1e3,1e4,1e5,1e6])
-
-class TestLinspace(TestCase):
- def test_basic(self):
- y = linspace(0,10)
- assert(len(y)==50)
- y = linspace(2,10,num=100)
- assert(y[-1] == 10)
- y = linspace(2,10,endpoint=0)
- assert(y[-1] < 10)
- y,st = linspace(2,10,retstep=1)
- assert_almost_equal(st,8/49.0)
- assert_array_almost_equal(y,mgrid[2:10:50j],13)
-
- def test_corner(self):
- y = list(linspace(0,1,1))
- assert y == [0.0], y
- y = list(linspace(0,1,2.5))
- assert y == [0.0, 1.0]
-
- def test_type(self):
- t1 = linspace(0,1,0).dtype
- t2 = linspace(0,1,1).dtype
- t3 = linspace(0,1,2).dtype
- assert_equal(t1, t2)
- assert_equal(t2, t3)
-
class TestInsert(TestCase):
def test_basic(self):
a = [1,2,3]
diff --git a/numpy/lib/tests/test_index_tricks.py b/numpy/lib/tests/test_index_tricks.py
index d7e61799a..3307cef3e 100644
--- a/numpy/lib/tests/test_index_tricks.py
+++ b/numpy/lib/tests/test_index_tricks.py
@@ -24,6 +24,11 @@ class TestGrid(TestCase):
assert_almost_equal(b[-1],b[0]+19*0.1,11)
assert_almost_equal(a[1]-a[0],2.0/9.0,11)
+ def test_linspace_equivalence(self):
+ y,st = np.linspace(2,10,retstep=1)
+ assert_almost_equal(st,8/49.0)
+ assert_array_almost_equal(y,mgrid[2:10:50j],13)
+
def test_nd(self):
c = mgrid[-1:1:10j,-2:2:10j]
d = mgrid[-1:1:0.1,-2:2:0.2]