summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-08-12 15:26:05 (GMT)
committerGuido van Rossum <guido@python.org>2002-08-12 15:26:05 (GMT)
commita6fa0e6f2e0e2df20b008f3e5c5b0be25a0516de (patch)
tree223331d94b5e25a99d58d889d8891c62c2ff4732 /Lib
parentbaf29638dafbfdd61452dd4dc64395ed63bc007d (diff)
downloadcpython-a6fa0e6f2e0e2df20b008f3e5c5b0be25a0516de.zip
cpython-a6fa0e6f2e0e2df20b008f3e5c5b0be25a0516de.tar.gz
cpython-a6fa0e6f2e0e2df20b008f3e5c5b0be25a0516de.tar.bz2
Portable way of producing unsigned 32-bit hex output to print the
CRCs.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_zlib.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py
index ab1c799..b7d99c3 100644
--- a/Lib/test/test_zlib.py
+++ b/Lib/test/test_zlib.py
@@ -12,8 +12,10 @@ buf = file.read() * 8
file.close()
# test the checksums (hex so the test doesn't break on 64-bit machines)
-print hex(zlib.crc32('penguin')), hex(zlib.crc32('penguin', 1))
-print hex(zlib.adler32('penguin')), hex(zlib.adler32('penguin', 1))
+def fix(x):
+ return "0x%x" % (x & 0xffffffffL)
+print fix(zlib.crc32('penguin')), fix(zlib.crc32('penguin', 1))
+print fix(zlib.adler32('penguin')), fix(zlib.adler32('penguin', 1))
# make sure we generate some expected errors
try: