[Python-checkins] cpython (2.7): Issue #23728: Added a test for binascii.crc_hqx().

serhiy.storchaka python-checkins at python.org
Mon Apr 20 08:33:19 CEST 2015


https://hg.python.org/cpython/rev/17702fd8ac0d
changeset:   95731:17702fd8ac0d
branch:      2.7
parent:      95726:cd7d51b5c951
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Mon Apr 20 09:32:29 2015 +0300
summary:
  Issue #23728: Added a test for binascii.crc_hqx().

files:
  Lib/test/test_binascii.py |  8 ++++++++
  1 files changed, 8 insertions(+), 0 deletions(-)


diff --git a/Lib/test/test_binascii.py b/Lib/test/test_binascii.py
--- a/Lib/test/test_binascii.py
+++ b/Lib/test/test_binascii.py
@@ -137,6 +137,14 @@
         # 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)

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list