diff options
author | Stefan van der Walt <stefan@sun.ac.za> | 2007-05-28 12:55:25 +0000 |
---|---|---|
committer | Stefan van der Walt <stefan@sun.ac.za> | 2007-05-28 12:55:25 +0000 |
commit | a27258edf4103aa0d3d1bce13c1acb987cbe7dca (patch) | |
tree | f8da280399392a8cc7524ed6d863ceb8943fee5c /numpy/lib/tests/test_function_base.py | |
parent | 944c32ad4a0618c834dcb06e50e90267df1d6835 (diff) | |
download | numpy-a27258edf4103aa0d3d1bce13c1acb987cbe7dca.tar.gz |
Clean up select docstring.
Diffstat (limited to 'numpy/lib/tests/test_function_base.py')
-rw-r--r-- | numpy/lib/tests/test_function_base.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index b22ce1318..77cc29199 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -65,6 +65,12 @@ class test_average(NumpyTestCase): assert_array_equal(actual, desired) class test_select(NumpyTestCase): + def _select(self,cond,values,default=0): + output = [] + for m in range(len(cond)): + output += [V[m] for V,C in zip(values,cond) if C[m]] or [default] + return output + def check_basic(self): choices = [array([1,2,3]), array([4,5,6]), @@ -73,7 +79,7 @@ class test_select(NumpyTestCase): array([0,1,0]), array([0,0,1])] assert_array_equal(select(conditions,choices,default=15), - [15,5,9]) + self._select(conditions,choices,default=15)) assert_equal(len(choices),3) assert_equal(len(conditions),3) |