(self, add)
| 5315 | |
| 5316 | class TestMaskedConstant: |
| 5317 | def _do_add_test(self, add): |
| 5318 | # sanity check |
| 5319 | assert_(add(np.ma.masked, 1) is np.ma.masked) |
| 5320 | |
| 5321 | # now try with a vector |
| 5322 | vector = np.array([1, 2, 3]) |
| 5323 | result = add(np.ma.masked, vector) |
| 5324 | |
| 5325 | # lots of things could go wrong here |
| 5326 | assert_(result is not np.ma.masked) |
| 5327 | assert_(not isinstance(result, np.ma.core.MaskedConstant)) |
| 5328 | assert_equal(result.shape, vector.shape) |
| 5329 | assert_equal(np.ma.getmask(result), np.ones(vector.shape, dtype=bool)) |
| 5330 | |
| 5331 | def test_ufunc(self): |
| 5332 | self._do_add_test(np.add) |
no test coverage detected