(self)
| 2681 | assert_array_equal(y, 3) |
| 2682 | |
| 2683 | def test_0d_comparison(self): |
| 2684 | x = 3 |
| 2685 | y = piecewise(x, [x <= 3, x > 3], [4, 0]) # Should succeed. |
| 2686 | assert_equal(y, 4) |
| 2687 | |
| 2688 | # With 3 ranges (It was failing, before) |
| 2689 | x = 4 |
| 2690 | y = piecewise(x, [x <= 3, (x > 3) * (x <= 5), x > 5], [1, 2, 3]) |
| 2691 | assert_array_equal(y, 2) |
| 2692 | |
| 2693 | assert_raises_regex(ValueError, '2 or 3 functions are expected', |
| 2694 | piecewise, x, [x <= 3, x > 3], [1]) |
| 2695 | assert_raises_regex(ValueError, '2 or 3 functions are expected', |
| 2696 | piecewise, x, [x <= 3, x > 3], [1, 1, 1, 1]) |
| 2697 | |
| 2698 | def test_0d_0d_condition(self): |
| 2699 | x = np.array(3) |
nothing calls this directly
no test coverage detected