(self)
| 296 | assert_array_equal(xe, array([0., 0.25, 0.5, 0.75, 1])) |
| 297 | |
| 298 | def test_dispatch(self): |
| 299 | class ShouldDispatch: |
| 300 | def __array_function__(self, function, types, args, kwargs): |
| 301 | return types, args, kwargs |
| 302 | |
| 303 | xy = [1, 2] |
| 304 | s_d = ShouldDispatch() |
| 305 | r = histogram2d(s_d, xy) |
| 306 | # Cannot use assert_equal since that dispatches... |
| 307 | assert_(r == ((ShouldDispatch,), (s_d, xy), {})) |
| 308 | r = histogram2d(xy, s_d) |
| 309 | assert_(r == ((ShouldDispatch,), (xy, s_d), {})) |
| 310 | r = histogram2d(xy, xy, bins=s_d) |
| 311 | assert_(r, ((ShouldDispatch,), (xy, xy), {'bins': s_d})) |
| 312 | r = histogram2d(xy, xy, bins=[s_d, 5]) |
| 313 | assert_(r, ((ShouldDispatch,), (xy, xy), {'bins': [s_d, 5]})) |
| 314 | assert_raises(Exception, histogram2d, xy, xy, bins=[s_d]) |
| 315 | r = histogram2d(xy, xy, weights=s_d) |
| 316 | assert_(r, ((ShouldDispatch,), (xy, xy), {'weights': s_d})) |
| 317 | |
| 318 | @pytest.mark.parametrize(("x_len", "y_len"), [(10, 11), (20, 19)]) |
| 319 | def test_bad_length(self, x_len, y_len): |
no test coverage detected