MCPcopy
hub / github.com/dask/dask / test_operators

Function test_operators

dask/array/tests/test_array_core.py:1209–1230  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1207
1208
1209def test_operators():
1210 x = np.arange(10)
1211 y = np.arange(10).reshape((10, 1))
1212 a = from_array(x, chunks=(5,))
1213 b = from_array(y, chunks=(5, 1))
1214
1215 c = a + 1
1216 assert_eq(c, x + 1)
1217
1218 c = a + b
1219 assert_eq(c, x + x.reshape((10, 1)))
1220
1221 expr = (3 / a * b) ** 2 > 5
1222 with warnings.catch_warnings():
1223 warnings.simplefilter("ignore", RuntimeWarning) # divide by zero
1224 assert_eq(expr, (3 / x * y) ** 2 > 5)
1225
1226 c = da.exp(a)
1227 assert_eq(c, np.exp(x))
1228
1229 assert_eq(abs(-a), a)
1230 assert_eq(a, +x)
1231
1232
1233def test_binary_operator_delegation(mocker):

Callers

nothing calls this directly

Calls 4

from_arrayFunction · 0.90
assert_eqFunction · 0.90
reshapeMethod · 0.80
arangeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…