diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2017-10-22 16:17:51 -0700 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2017-10-22 16:18:06 -0700 |
commit | 303941c929ee2938dc55ad633c9fc063610941b9 (patch) | |
tree | e4d301a5af8822837967f72dabd61c81b88c278c /numpy/lib/tests/test_function_base.py | |
parent | 4729550aa44c97b11d4c9bd39af9bc093c2ce0f8 (diff) | |
download | numpy-303941c929ee2938dc55ad633c9fc063610941b9.tar.gz |
TST: Add test for 0d conditions in np.piecewise
Diffstat (limited to 'numpy/lib/tests/test_function_base.py')
-rw-r--r-- | numpy/lib/tests/test_function_base.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index 2a42c44e6..e25962da9 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -2556,6 +2556,12 @@ class TestPiecewise(object): y = piecewise(x, [x <= 3, (x > 3) * (x <= 5), x > 5], [1, 2, 3]) assert_array_equal(y, 2) + def test_0d_0d_condition(self): + x = np.array(3) + c = np.array(x > 3) + y = piecewise(x, [c], [1, 2]) + assert_equal(y, 2) + def test_multidimensional_extrafunc(self): x = np.array([[-2.5, -1.5, -0.5], [0.5, 1.5, 2.5]]) |