crc32 always returns unsigned. cleanup the code a bit and revert r61648 with

the proper fix.
This commit is contained in:
Gregory P. Smith 2008-03-20 06:20:09 +00:00
parent 97797a9c3c
commit 2727503bc9
3 changed files with 16 additions and 28 deletions

View file

@ -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'))