summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2000-08-15 06:08:31 (GMT)
committerBarry Warsaw <barry@python.org>2000-08-15 06:08:31 (GMT)
commit97ca66fd57668b40d61309d2e044a17311c265ac (patch)
tree1b0a07881b08e84ba6304fd440a73d5ab2260bd1 /Lib/test
parent0be4346da6250868f9c1788542e71cba062d2553 (diff)
downloadcpython-97ca66fd57668b40d61309d2e044a17311c265ac.zip
cpython-97ca66fd57668b40d61309d2e044a17311c265ac.tar.gz
cpython-97ca66fd57668b40d61309d2e044a17311c265ac.tar.bz2
tests for binascii.b2a_hex() and binascii.a2b_hex().
Diffstat (limited to 'Lib/test')
-rwxr-xr-xLib/test/test_binascii.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/Lib/test/test_binascii.py b/Lib/test/test_binascii.py
index 28908ef..52f817b 100755
--- a/Lib/test/test_binascii.py
+++ b/Lib/test/test_binascii.py
@@ -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'