summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_zlib.py
diff options
context:
space:
mode:
authorGregory P. Smith <greg@mad-scientist.com>2008-03-17 20:24:09 (GMT)
committerGregory P. Smith <greg@mad-scientist.com>2008-03-17 20:24:09 (GMT)
commitab0d8a1f59aaa71b234c1c273dd61b951950678d (patch)
tree81175c7432eafcd479d9713a0d1c2af245c91c2a /Lib/test/test_zlib.py
parentc55485bc6d4a22026e12ccc6b772984059468a86 (diff)
downloadcpython-ab0d8a1f59aaa71b234c1c273dd61b951950678d.zip
cpython-ab0d8a1f59aaa71b234c1c273dd61b951950678d.tar.gz
cpython-ab0d8a1f59aaa71b234c1c273dd61b951950678d.tar.bz2
zlib.crc32 and zlib.adler32 now return an unsigned value as any sane person
would expect. Fixes issues1202.
Diffstat (limited to 'Lib/test/test_zlib.py')
-rw-r--r--Lib/test/test_zlib.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py
index 13656d6..6b7d4a6 100644
--- a/Lib/test/test_zlib.py
+++ b/Lib/test/test_zlib.py
@@ -38,6 +38,14 @@ class ChecksumTestCase(unittest.TestCase):
self.assertEqual(zlib.crc32(b"penguin"), zlib.crc32(b"penguin", 0))
self.assertEqual(zlib.adler32(b"penguin"),zlib.adler32(b"penguin",1))
+ def test_crc32_adler32_unsigned(self):
+ foo = 'abcdefghijklmnop'
+ # explicitly test signed behavior
+ self.assertEqual(zlib.crc32(foo), 2486878355)
+ self.assertEqual(zlib.crc32('spam'), 1138425661)
+ self.assertEqual(zlib.adler32(foo+foo), 3573550353)
+ self.assertEqual(zlib.adler32('spam'), 72286642)
+
class ExceptionTestCase(unittest.TestCase):