]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
tests for binascii.b2a_hex() and binascii.a2b_hex().
authorBarry Warsaw <barry@python.org>
Tue, 15 Aug 2000 06:08:31 +0000 (06:08 +0000)
committerBarry Warsaw <barry@python.org>
Tue, 15 Aug 2000 06:08:31 +0000 (06:08 +0000)
Lib/test/test_binascii.py

index 28908ef377582366ec7ed4729911039a8afa1dba..52f817b0379e9a6c0af85f5a2eb84874c4b341ad 100755 (executable)
@@ -91,3 +91,22 @@ if crc != 1571220330:
     print "binascii.crc32() failed."
 
 # The hqx test is in test_binhex.py
+
+# test hexlification
+s = '{s\005\000\000\000worldi\002\000\000\000s\005\000\000\000helloi\001\000\000\0000'
+t = binascii.b2a_hex(s)
+u = binascii.a2b_hex(t)
+if s <> u:
+    print 'binascii hexlification failed'
+try:
+    binascii.a2b_hex(t[:-1])
+except TypeError:
+    pass
+else:
+    print 'expected TypeError not raised'
+try:
+    binascii.a2b_hex(t[:-1] + 'q')
+except TypeError:
+    pass
+else:
+    print 'expected TypeError not raised'