mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
zlib.crc32 and zlib.adler32 now return an unsigned value as any sane person
would expect. Fixes issues1202.
This commit is contained in:
parent
c55485bc6d
commit
ab0d8a1f59
3 changed files with 14 additions and 2 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue