[Python-checkins] CVS: python/dist/src/Lib/test test_exceptions.py,1.6,1.7

Jeremy Hylton python-dev@python.org
2000年6月20日 11:53:00 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory slayer.i.sourceforge.net:/tmp/cvs-serv25768
Modified Files:
	test_exceptions.py 
Log Message:
add minimal test of exception use. verify that each exception can be
raised, caught, and converted to a string.
Index: test_exceptions.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_exceptions.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** test_exceptions.py	2000年05月25日 23:16:34	1.6
--- test_exceptions.py	2000年06月20日 18:52:57	1.7
***************
*** 7,11 ****
--- 7,23 ----
 # XXX This is not really enough, each *operation* should be tested!
 
+ def test_raise_catch(exc):
+ try:
+ raise exc, "spam"
+ except exc, err:
+ buf = str(err)
+ try:
+ raise exc("spam")
+ except exc, err:
+ buf = str(err)
+ print buf
+ 
 def r(thing):
+ test_raise_catch(thing)
 if type(thing) == ClassType:
 print thing.__name__

AltStyle によって変換されたページ (->オリジナル) /