summaryrefslogtreecommitdiff
path: root/Lib/test/test_struct.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-01-03 19:00:37 +0000
committerGuido van Rossum <guido@python.org>1997-01-03 19:00:37 +0000
commit12685265220097d539cd26cf2bfa177176af252c (patch)
treef0de90b2ec265d1cf181febb1dec5aa879902e0b /Lib/test/test_struct.py
parent4a3aac4b6f7b0f1085769e3c6a7c2f7d26154294 (diff)
downloadcpython-12685265220097d539cd26cf2bfa177176af252c.tar.gz
Change the ``calcsize*3'' test to be portable to 64-bit machines.
Diffstat (limited to 'Lib/test/test_struct.py')
-rw-r--r--Lib/test/test_struct.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/test/test_struct.py b/Lib/test/test_struct.py
index 954a3f26e9..c1e7b9ea3b 100644
--- a/Lib/test/test_struct.py
+++ b/Lib/test/test_struct.py
@@ -18,9 +18,13 @@ sz = struct.calcsize('i')
if sz * 3 <> struct.calcsize('iii'):
raise TestFailed, 'inconsistent sizes'
-sz = struct.calcsize('cbhilfd')
-if sz * 3 <> struct.calcsize('3c3b3h3i3l3f3d'):
- raise TestFailed, 'inconsistent sizes'
+fmt = 'cbxxxxxxhhhhiillffd'
+fmt3 = '3c3b18x12h6i6l6f3d'
+sz = struct.calcsize(fmt)
+sz3 = struct.calcsize(fmt3)
+if sz * 3 <> sz3:
+ raise TestFailed, 'inconsistent sizes (3*%s -> 3*%d = %d, %s -> %d)' % (
+ `fmt`, sz, 3*sz, `fmt3`, sz3)
simple_err(struct.pack, 'iii', 3)
simple_err(struct.pack, 'i', 3, 3, 3)