summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_zlib.py
diff options
context:
space:
mode:
authorGregory P. Smith <greg@mad-scientist.com>2008-03-18 22:27:41 (GMT)
committerGregory P. Smith <greg@mad-scientist.com>2008-03-18 22:27:41 (GMT)
commitc856fa811dfdd6d17396d9aa522eea19b0f46c93 (patch)
treedf1e5900e00c10f3cc4782ffc1aa963ee73e2efa /Lib/test/test_zlib.py
parent6a644f92efb35e75f81d183aebfff3260b1454e2 (diff)
downloadcpython-c856fa811dfdd6d17396d9aa522eea19b0f46c93.zip
cpython-c856fa811dfdd6d17396d9aa522eea19b0f46c93.tar.gz
cpython-c856fa811dfdd6d17396d9aa522eea19b0f46c93.tar.bz2
Add a test to make sure zlib.crc32 and binascii.crc32 return the same thing.
Fix a buglet in binascii.crc32, the second optional argument could previously have a signedness mismatch with the C variable its going into.
Diffstat (limited to 'Lib/test/test_zlib.py')
-rw-r--r--Lib/test/test_zlib.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py
index 7c7ef26..9f0fe18 100644
--- a/Lib/test/test_zlib.py
+++ b/Lib/test/test_zlib.py
@@ -1,6 +1,7 @@
import unittest
from test import test_support
import zlib
+import binascii
import random
@@ -47,6 +48,11 @@ class ChecksumTestCase(unittest.TestCase):
self.assertEqual(zlib.adler32(foo+foo), -721416943)
self.assertEqual(zlib.adler32('spam'), 72286642)
+ def test_same_as_binascii_crc32(self):
+ foo = 'abcdefghijklmnop'
+ self.assertEqual(binascii.crc32(foo), zlib.crc32(foo))
+ self.assertEqual(binascii.crc32('spam'), zlib.crc32('spam'))
+
class ExceptionTestCase(unittest.TestCase):