| 372 | |
| 373 | |
| 374 | def test_frompyfunc(): |
| 375 | myadd = da.frompyfunc(add, 2, 1) |
| 376 | np_myadd = np.frompyfunc(add, 2, 1) |
| 377 | |
| 378 | x = np.random.normal(0, 10, size=(10, 10)) |
| 379 | dx = da.from_array(x, chunks=(3, 4)) |
| 380 | y = np.random.normal(0, 10, size=10) |
| 381 | dy = da.from_array(y, chunks=2) |
| 382 | |
| 383 | assert_eq(myadd(dx, dy), np_myadd(x, y)) |
| 384 | assert_eq(myadd.outer(dx, dy), np_myadd.outer(x, y)) |
| 385 | |
| 386 | with pytest.raises(NotImplementedError): |
| 387 | da.frompyfunc(lambda x, y: (x + y, x - y), 2, 2) |
| 388 | |
| 389 | |
| 390 | def test_frompyfunc_wrapper(): |