MCPcopy Create free account
hub / github.com/dask/dask / test_operators

Function test_operators

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

Source from the content-addressed store, hash-verified

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