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