[Python-checkins] python/dist/src/Lib/test test_format.py,1.14,1.15

nnorwitz@users.sourceforge.net nnorwitz@users.sourceforge.net
Sun, 28 Jul 2002 09:44:26 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv6096/Lib/test

Modified Files:
	test_format.py 
Log Message:
Fix the problem of not raising a TypeError exception when doing:
    '%g' % '1'
    '%d' % '1'

Add a test for these conditions
Fix the test so that if not exception is raise, this is a failure


Index: test_format.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_format.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** test_format.py	23 Jul 2002 19:03:53 -0000	1.14
--- test_format.py	28 Jul 2002 16:44:23 -0000	1.15
***************
*** 1,3 ****
! from test.test_support import verbose, have_unicode
  import sys
  
--- 1,3 ----
! from test.test_support import verbose, have_unicode, TestFailed
  import sys
  
***************
*** 211,214 ****
--- 211,216 ----
          print 'Unexpected exception'
          raise
+     else:
+         raise TestFailed, 'did not get expected exception: %s' % excmsg
  
  test_exc('abc %a', 1, ValueError,
***************
*** 217,218 ****
--- 219,224 ----
      test_exc(unicode('abc %\u3000','raw-unicode-escape'), 1, ValueError,
               "unsupported format character '?' (0x3000) at index 5")
+ 
+ test_exc('%d', '1', TypeError, "int argument required")
+ test_exc('%g', '1', TypeError, "float argument required")
+