[Python-checkins] CVS: python/dist/src/Lib/test test_binascii.py,1.5,1.6
Barry Warsaw
python-dev@python.org
Mon, 14 Aug 2000 23:08:33 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory slayer.i.sourceforge.net:/tmp/cvs-serv3009
Modified Files:
test_binascii.py
Log Message:
tests for binascii.b2a_hex() and binascii.a2b_hex().
Index: test_binascii.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_binascii.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** test_binascii.py 2000/02/16 21:13:06 1.5
--- test_binascii.py 2000/08/15 06:08:31 1.6
***************
*** 92,93 ****
--- 92,112 ----
# 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'