()
| 1207 | |
| 1208 | |
| 1209 | def 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 | |
| 1233 | def test_binary_operator_delegation(mocker): |
nothing calls this directly
no test coverage detected
searching dependent graphs…