(self)
| 235 | assert_equal(mbase.b._mask, [1, 1, 0, 0, 1]) |
| 236 | |
| 237 | def test_setslices_hardmask(self): |
| 238 | # Tests setting slices w/ hardmask. |
| 239 | base = self.base.copy() |
| 240 | mbase = base.view(mrecarray) |
| 241 | mbase.harden_mask() |
| 242 | try: |
| 243 | mbase[-2:] = (5, 5, 5) |
| 244 | assert_equal(mbase.a._data, [1, 2, 3, 5, 5]) |
| 245 | assert_equal(mbase.b._data, [1.1, 2.2, 3.3, 5, 5.5]) |
| 246 | assert_equal(mbase.c._data, |
| 247 | [b'one', b'two', b'three', b'5', b'five']) |
| 248 | assert_equal(mbase.a._mask, [0, 1, 0, 0, 1]) |
| 249 | assert_equal(mbase.b._mask, mbase.a._mask) |
| 250 | assert_equal(mbase.b._mask, mbase.c._mask) |
| 251 | except NotImplementedError: |
| 252 | # OK, not implemented yet... |
| 253 | pass |
| 254 | except AssertionError: |
| 255 | raise |
| 256 | else: |
| 257 | raise Exception("Flexible hard masks should be supported !") |
| 258 | # Not using a tuple should crash |
| 259 | try: |
| 260 | mbase[-2:] = 3 |
| 261 | except (NotImplementedError, TypeError): |
| 262 | pass |
| 263 | else: |
| 264 | raise TypeError("Should have expected a readable buffer object!") |
| 265 | |
| 266 | def test_hardmask(self): |
| 267 | # Test hardmask |
nothing calls this directly
no test coverage detected