From 303941c929ee2938dc55ad633c9fc063610941b9 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Sun, 22 Oct 2017 16:17:51 -0700 Subject: TST: Add test for 0d conditions in np.piecewise --- numpy/lib/tests/test_function_base.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'numpy/lib/tests/test_function_base.py') 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]]) -- cgit v1.2.1