MCPcopy
hub / github.com/dask/dask / test_frompyfunc_wrapper

Function test_frompyfunc_wrapper

dask/array/tests/test_ufunc.py:391–421  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

389
390
391def 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
424def test_array_ufunc():

Callers

nothing calls this directly

Calls 5

da_frompyfuncClass · 0.90
fFunction · 0.70
f2Function · 0.50
tokenizeFunction · 0.50
outerMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…