(self)
| 120 | |
| 121 | @unittest.expectedFailure # TODO: RUSTPYTHON |
| 122 | def test_raw_ndarray(self): |
| 123 | # 1-D, contiguous |
| 124 | ndarray = import_helper.import_module("_testbuffer").ndarray |
| 125 | arr = ndarray(list(range(3)), shape=(3,), format='<h') |
| 126 | equiv = b"\x00\x00\x01\x00\x02\x00" |
| 127 | self.check_raw(arr, equiv) |
| 128 | # 2-D, C-contiguous |
| 129 | arr = ndarray(list(range(6)), shape=(2, 3), format='<h') |
| 130 | equiv = b"\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00" |
| 131 | self.check_raw(arr, equiv) |
| 132 | # 2-D, F-contiguous |
| 133 | arr = ndarray(list(range(6)), shape=(2, 3), strides=(2, 4), |
| 134 | format='<h') |
| 135 | # Note this is different from arr.tobytes() |
| 136 | equiv = b"\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00" |
| 137 | self.check_raw(arr, equiv) |
| 138 | # 0-D |
| 139 | arr = ndarray(456, shape=(), format='<i') |
| 140 | equiv = b'\xc8\x01\x00\x00' |
| 141 | self.check_raw(arr, equiv) |
| 142 | |
| 143 | @unittest.expectedFailure # TODO: RUSTPYTHON |
| 144 | def check_raw_non_contiguous(self, obj): |
nothing calls this directly
no test coverage detected