Skip to content

Commit ffa4d47

Browse files
authored
gh-146238: Add missing tests for 'e', 'Zf' and 'Zd' array type codes in test_buffer (#149345)
This amends e79fd60. I'll not fix this for 'F'/'D' complex types as they might be removed.
1 parent 0b75b73 commit ffa4d47

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

Lib/test/test_buffer.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def native_type_range(fmt):
143143
# Format codes supported by array.array
144144
ARRAY = NATIVE.copy()
145145
for k in NATIVE:
146-
if not k in "bBhHiIlLfd":
146+
if k not in list("bBhHiIlLefd") + ['Zf', 'Zd']:
147147
del ARRAY[k]
148148

149149
BYTEFMT = NATIVE.copy()
@@ -4495,8 +4495,10 @@ def test_bytearray_alignment(self):
44954495
def test_array_alignment(self):
44964496
# gh-140557: pointer alignment of buffers including empty allocation
44974497
# should match the maximum array alignment.
4498-
align = max(struct.calcsize(fmt) for fmt in ARRAY)
4499-
cases = [array.array(fmt) for fmt in ARRAY]
4498+
formats = [fmt for fmt in ARRAY
4499+
if struct.calcsize(fmt) <= struct.calcsize('P')]
4500+
align = max(struct.calcsize(fmt) for fmt in formats)
4501+
cases = [array.array(fmt) for fmt in formats]
45004502
# Empty arrays
45014503
self.assertEqual(
45024504
[_testcapi.buffer_pointer_as_int(case) % align for case in cases],

0 commit comments

Comments
 (0)