Skip to content

Commit 9086469

Browse files
test: add test
1 parent 378edc6 commit 9086469

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

test/test_memoryview.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,15 @@ def test_multidim_memoryview():
9797
data = view.cast(view.format, (3, 2))
9898
packed = packb(data)
9999
assert packed == b"\xc4\x06\x00\x00\x00\x00\x00\x00"
100+
101+
102+
def test_unpack_noncontiguous_memoryview():
103+
# Use a multi-byte value so the padded stride-2 view is non-contiguous.
104+
packed = packb(2**32)
105+
padded = bytearray()
106+
for byte in packed:
107+
padded.append(byte)
108+
padded.append(0)
109+
noncont = memoryview(bytes(padded))[::2]
110+
assert not noncont.c_contiguous
111+
assert unpackb(noncont) == 2**32

0 commit comments

Comments
 (0)