summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_function_base.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/lib/tests/test_function_base.py')
-rw-r--r--numpy/lib/tests/test_function_base.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py
index cb4d6626d..ee38b3573 100644
--- a/numpy/lib/tests/test_function_base.py
+++ b/numpy/lib/tests/test_function_base.py
@@ -1487,6 +1487,7 @@ class TestPiecewise(TestCase):
x = piecewise([0, 0], [[False, True]], [lambda x:-1])
assert_array_equal(x, [0, -1])
+ def test_two_conditions(self):
x = piecewise([1, 2], [[True, False], [False, True]], [3, 4])
assert_array_equal(x, [3, 4])
@@ -1505,6 +1506,15 @@ class TestPiecewise(TestCase):
assert_(y.ndim == 0)
assert_(y == 0)
+ x = 5
+ y = piecewise(x, [[True], [False]], [1, 0])
+ assert_(y.ndim == 0)
+ assert_(y == 1)
+
+ def test_0d_comparison(self):
+ x = 3
+ y = piecewise(x, [x <= 3, x > 3], [4, 0])
+
class TestBincount(TestCase):
def test_simple(self):