(self)
| 1158 | return x, y, a10, m1, m2, xm, ym, z, zm, xf |
| 1159 | |
| 1160 | def test_basic_arithmetic(self): |
| 1161 | # Test of basic arithmetic. |
| 1162 | x, y, a10, _, _, xm, ym, _, _, xf = self._create_data() |
| 1163 | a2d = array([[1, 2], [0, 4]]) |
| 1164 | a2dm = masked_array(a2d, [[0, 0], [1, 0]]) |
| 1165 | assert_equal(a2d * a2d, a2d * a2dm) |
| 1166 | assert_equal(a2d + a2d, a2d + a2dm) |
| 1167 | assert_equal(a2d - a2d, a2d - a2dm) |
| 1168 | for s in [(12,), (4, 3), (2, 6)]: |
| 1169 | x = x.reshape(s) |
| 1170 | y = y.reshape(s) |
| 1171 | xm = xm.reshape(s) |
| 1172 | ym = ym.reshape(s) |
| 1173 | xf = xf.reshape(s) |
| 1174 | assert_equal(-x, -xm) |
| 1175 | assert_equal(x + y, xm + ym) |
| 1176 | assert_equal(x - y, xm - ym) |
| 1177 | assert_equal(x * y, xm * ym) |
| 1178 | assert_equal(x / y, xm / ym) |
| 1179 | assert_equal(a10 + y, a10 + ym) |
| 1180 | assert_equal(a10 - y, a10 - ym) |
| 1181 | assert_equal(a10 * y, a10 * ym) |
| 1182 | assert_equal(a10 / y, a10 / ym) |
| 1183 | assert_equal(x + a10, xm + a10) |
| 1184 | assert_equal(x - a10, xm - a10) |
| 1185 | assert_equal(x * a10, xm * a10) |
| 1186 | assert_equal(x / a10, xm / a10) |
| 1187 | assert_equal(x ** 2, xm ** 2) |
| 1188 | assert_equal(abs(x) ** 2.5, abs(xm) ** 2.5) |
| 1189 | assert_equal(x ** y, xm ** ym) |
| 1190 | assert_equal(np.add(x, y), add(xm, ym)) |
| 1191 | assert_equal(np.subtract(x, y), subtract(xm, ym)) |
| 1192 | assert_equal(np.multiply(x, y), multiply(xm, ym)) |
| 1193 | assert_equal(np.divide(x, y), divide(xm, ym)) |
| 1194 | |
| 1195 | def test_divide_on_different_shapes(self): |
| 1196 | x = arange(6, dtype=float).reshape((2, 3)) |
nothing calls this directly
no test coverage detected