diff options
author | Travis Oliphant <oliphant@enthought.com> | 2008-06-17 20:08:28 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2008-06-17 20:08:28 +0000 |
commit | 660dacef79bf3e78502309f791b3195b14fa63df (patch) | |
tree | 95ff74b14c08c9803edf21ea90e6a75c0802997b /numpy/lib/tests/test_function_base.py | |
parent | 3a917b8d20bae0bec932019ffa3fa82ae6eabf5a (diff) | |
download | numpy-660dacef79bf3e78502309f791b3195b14fa63df.tar.gz |
Fix piecewise to handle 0-d inputs.
Diffstat (limited to 'numpy/lib/tests/test_function_base.py')
-rw-r--r-- | numpy/lib/tests/test_function_base.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index 3cd7cd6bb..c885f49af 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -616,5 +616,12 @@ def compare_results(res,desired): for i in range(len(desired)): assert_array_equal(res[i],desired[i]) +class TestPiecewise(TestCase): + def test_0d(self): + x = array(3) + y = piecewise(x, x>3, [4, 0]) + assert y.ndim == 0 + assert y == 0 + if __name__ == "__main__": nose.run(argv=['', __file__]) |