]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #23728: Added a test for binascii.crc_hqx().
authorSerhiy Storchaka <storchaka@gmail.com>
Mon, 20 Apr 2015 06:32:29 +0000 (09:32 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Mon, 20 Apr 2015 06:32:29 +0000 (09:32 +0300)
Lib/test/test_binascii.py

index f825f1c0779981ccfe0289c4857ae9c99c02ce46..d40b672a7c1cce05416ae9e11e9bce5454de9354 100644 (file)
@@ -137,6 +137,14 @@ class BinASCIITest(unittest.TestCase):
         # Issue #7701 (crash on a pydebug build)
         self.assertEqual(binascii.b2a_uu('x'), '!>   \n')
 
+    def test_crc_hqx(self):
+        crc = binascii.crc_hqx(self.type2test(b"Test the CRC-32 of"), 0)
+        crc = binascii.crc_hqx(self.type2test(b" this string."), crc)
+        self.assertEqual(crc, 14290)
+
+        self.assertRaises(TypeError, binascii.crc_hqx)
+        self.assertRaises(TypeError, binascii.crc_hqx, self.type2test(b''))
+
     def test_crc32(self):
         crc = binascii.crc32(self.type2test("Test the CRC-32 of"))
         crc = binascii.crc32(self.type2test(" this string."), crc)