summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_function_base.py
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-07-19 16:19:00 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-07-19 16:19:00 +0000
commit50831666840ec2ee065569c3e3c9fbc5461fc918 (patch)
treeb78da6fbbdd235fb2216763e0511ce75b4b9dde1 /numpy/lib/tests/test_function_base.py
parent0991c5d70f87c38a92364da8485be265762686db (diff)
downloadnumpy-50831666840ec2ee065569c3e3c9fbc5461fc918.tar.gz
Apply patch for unique from #154
Diffstat (limited to 'numpy/lib/tests/test_function_base.py')
-rw-r--r--numpy/lib/tests/test_function_base.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py
index b359d5732..4642725fc 100644
--- a/numpy/lib/tests/test_function_base.py
+++ b/numpy/lib/tests/test_function_base.py
@@ -353,7 +353,15 @@ class test_histogram(NumpyTestCase):
(a,b)=histogram(linspace(0,10,100))
assert(all(a==10))
-
+class test_unique(NumpyTestCase):
+ def check_simple(self):
+ x = array([4,3,2,1,1,2,3,4, 0])
+ assert(all(unique(x) == [0,1,2,3,4]))
+ assert(unique(array([1,1,1,1,1])) == array([1]))
+ x = ['widget', 'ham', 'foo', 'bar', 'foo', 'ham']
+ assert(all(unique(x) == ['bar', 'foo', 'ham', 'widget']))
+ x = array([5+6j, 1+1j, 1+10j, 10, 5+6j])
+ assert(all(unique(x) == [1+1j, 1+10j, 5+6j, 10]))
def compare_results(res,desired):
for i in range(len(desired)):