(self)
| 74 | self.assertIsNone(wpb()) |
| 75 | |
| 76 | def test_ndarray_2d(self): |
| 77 | # C-contiguous |
| 78 | ndarray = import_helper.import_module("_testbuffer").ndarray |
| 79 | arr = ndarray(list(range(12)), shape=(4, 3), format='<i') |
| 80 | self.assertTrue(arr.c_contiguous) |
| 81 | self.assertFalse(arr.f_contiguous) |
| 82 | pb = PickleBuffer(arr) |
| 83 | self.check_memoryview(pb, arr) |
| 84 | # Non-contiguous |
| 85 | arr = arr[::2] |
| 86 | self.assertFalse(arr.c_contiguous) |
| 87 | self.assertFalse(arr.f_contiguous) |
| 88 | pb = PickleBuffer(arr) |
| 89 | self.check_memoryview(pb, arr) |
| 90 | # F-contiguous |
| 91 | arr = ndarray(list(range(12)), shape=(3, 4), strides=(4, 12), format='<i') |
| 92 | self.assertTrue(arr.f_contiguous) |
| 93 | self.assertFalse(arr.c_contiguous) |
| 94 | pb = PickleBuffer(arr) |
| 95 | self.check_memoryview(pb, arr) |
| 96 | |
| 97 | # Tests for PickleBuffer.raw() |
| 98 |
nothing calls this directly
no test coverage detected