mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
crc32 always returns unsigned. cleanup the code a bit and revert r61648 with
the proper fix.
This commit is contained in:
parent
97797a9c3c
commit
2727503bc9
3 changed files with 16 additions and 28 deletions
|
@ -42,14 +42,14 @@ class ChecksumTestCase(unittest.TestCase):
|
|||
def test_crc32_adler32_unsigned(self):
|
||||
foo = 'abcdefghijklmnop'
|
||||
# explicitly test signed behavior
|
||||
self.assertEqual(zlib.crc32(foo), -1808088941)
|
||||
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)
|
||||
|
||||
def test_same_as_binascii_crc32(self):
|
||||
foo = 'abcdefghijklmnop'
|
||||
crc = -1808088941
|
||||
crc = 2486878355
|
||||
self.assertEqual(binascii.crc32(foo), crc)
|
||||
self.assertEqual(zlib.crc32(foo), crc)
|
||||
self.assertEqual(binascii.crc32('spam'), zlib.crc32('spam'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue