| 359 | |
| 360 | |
| 361 | def test_frompyfunc(): |
| 362 | myadd = da.frompyfunc(add, 2, 1) |
| 363 | np_myadd = np.frompyfunc(add, 2, 1) |
| 364 | |
| 365 | x = np.random.normal(0, 10, size=(10, 10)) |
| 366 | dx = da.from_array(x, chunks=(3, 4)) |
| 367 | y = np.random.normal(0, 10, size=10) |
| 368 | dy = da.from_array(y, chunks=2) |
| 369 | |
| 370 | assert_eq(myadd(dx, dy), np_myadd(x, y)) |
| 371 | assert_eq(myadd.outer(dx, dy), np_myadd.outer(x, y)) |
| 372 | |
| 373 | with pytest.raises(NotImplementedError): |
| 374 | da.frompyfunc(lambda x, y: (x + y, x - y), 2, 2) |
| 375 | |
| 376 | |
| 377 | def test_frompyfunc_wrapper(): |