mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
tests for binascii.b2a_hex() and binascii.a2b_hex().
This commit is contained in:
parent
0be4346da6
commit
97ca66fd57
1 changed files with 19 additions and 0 deletions
|
@ -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'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue