(self)
| 2944 | assert_array_equal(y, 3) |
| 2945 | |
| 2946 | def test_0d_comparison(self): |
| 2947 | x = 3 |
| 2948 | y = piecewise(x, [x <= 3, x > 3], [4, 0]) # Should succeed. |
| 2949 | assert_equal(y, 4) |
| 2950 | |
| 2951 | # With 3 ranges (It was failing, before) |
| 2952 | x = 4 |
| 2953 | y = piecewise(x, [x <= 3, (x > 3) * (x <= 5), x > 5], [1, 2, 3]) |
| 2954 | assert_array_equal(y, 2) |
| 2955 | |
| 2956 | assert_raises_regex(ValueError, '2 or 3 functions are expected', |
| 2957 | piecewise, x, [x <= 3, x > 3], [1]) |
| 2958 | assert_raises_regex(ValueError, '2 or 3 functions are expected', |
| 2959 | piecewise, x, [x <= 3, x > 3], [1, 1, 1, 1]) |
| 2960 | |
| 2961 | def test_0d_0d_condition(self): |
| 2962 | x = np.array(3) |
nothing calls this directly
no test coverage detected