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