(self)
| 411 | assert_(pa.flags.aligned) |
| 412 | |
| 413 | def test_pickle_void(self): |
| 414 | # issue gh-13593 |
| 415 | dt = np.dtype([('obj', 'O'), ('int', 'i')]) |
| 416 | a = np.empty(1, dtype=dt) |
| 417 | data = (bytearray(b'eman'),) |
| 418 | a['obj'] = data |
| 419 | a['int'] = 42 |
| 420 | ctor, args = a[0].__reduce__() |
| 421 | # check the constructor is what we expect before interpreting the arguments |
| 422 | assert ctor is np.core.multiarray.scalar |
| 423 | dtype, obj = args |
| 424 | # make sure we did not pickle the address |
| 425 | assert not isinstance(obj, bytes) |
| 426 | |
| 427 | assert_raises(RuntimeError, ctor, dtype, 13) |
| 428 | |
| 429 | # Test roundtrip: |
| 430 | dump = pickle.dumps(a[0]) |
| 431 | unpickled = pickle.loads(dump) |
| 432 | assert a[0] == unpickled |
| 433 | |
| 434 | # Also check the similar (impossible) "object scalar" path: |
| 435 | with pytest.warns(DeprecationWarning): |
| 436 | assert ctor(np.dtype("O"), data) is data |
| 437 | |
| 438 | def test_objview_record(self): |
| 439 | # https://github.com/numpy/numpy/issues/2599 |
nothing calls this directly
no test coverage detected