()
| 389 | |
| 390 | |
| 391 | def test_frompyfunc_wrapper(): |
| 392 | f = da_frompyfunc(add, 2, 1) |
| 393 | np_f = np.frompyfunc(add, 2, 1) |
| 394 | x = np.array([1, 2, 3]) |
| 395 | |
| 396 | # Callable |
| 397 | np.testing.assert_equal(f(x, 1), np_f(x, 1)) |
| 398 | |
| 399 | # picklable |
| 400 | f2 = pickle.loads(pickle.dumps(f)) |
| 401 | np.testing.assert_equal(f2(x, 1), np_f(x, 1)) |
| 402 | |
| 403 | # Attributes |
| 404 | assert f.ntypes == np_f.ntypes |
| 405 | with pytest.raises(AttributeError): |
| 406 | f.not_an_attribute |
| 407 | |
| 408 | # Tab completion |
| 409 | assert "ntypes" in dir(f) |
| 410 | |
| 411 | # Methods |
| 412 | np.testing.assert_equal(f.outer(x, x), np_f.outer(x, x)) |
| 413 | |
| 414 | # funcname |
| 415 | assert f.__name__ == "frompyfunc-add" |
| 416 | |
| 417 | # repr |
| 418 | assert repr(f) == "da.frompyfunc<add, 2, 1>" |
| 419 | |
| 420 | # tokenize |
| 421 | assert tokenize(da_frompyfunc(add, 2, 1)) == tokenize(da_frompyfunc(add, 2, 1)) |
| 422 | |
| 423 | |
| 424 | def test_array_ufunc(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…