[Python-checkins] python/dist/src/Lib/test test_string.py, 1.27, 1.28 string_tests.py, 1.45, 1.46

mwh@users.sourceforge.net mwh at users.sourceforge.net
Fri Oct 21 13:45:04 CEST 2005


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12867/Lib/test

Modified Files:
	test_string.py string_tests.py 
Log Message:
Fix bug:

[ 1327110 ] wrong TypeError traceback in generator expressions

by removing the code that can stomp on the users' TypeError raised by the 
iterable argument to ''.join() -- PySequence_Fast (now?) gives a perfectly
reasonable message itself.  Also, a couple of tests.


Index: test_string.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_string.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- test_string.py	26 Aug 2004 16:53:04 -0000	1.27
+++ test_string.py	21 Oct 2005 11:45:01 -0000	1.28
@@ -51,6 +51,17 @@
 
         self.checkraises(TypeError, string_tests.BadSeq1(), 'join', ' ')
         self.checkequal('a b c', string_tests.BadSeq2(), 'join', ' ')
+        try:
+            def f():
+                yield 4 + ""
+            self.fixtype(' ').join(f())
+        except TypeError, e:
+            if '+' not in str(e):
+                self.fail('join() ate exception message')
+        else:
+            self.fail('exception not raised')
+
+
 
 
 class ModuleTest(unittest.TestCase):

Index: string_tests.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/string_tests.py,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- string_tests.py	28 Jul 2005 16:49:15 -0000	1.45
+++ string_tests.py	21 Oct 2005 11:45:01 -0000	1.46
@@ -657,6 +657,15 @@
         self.checkraises(TypeError, ' ', 'join')
         self.checkraises(TypeError, ' ', 'join', 7)
         self.checkraises(TypeError, ' ', 'join', Sequence([7, 'hello', 123L]))
+        try:
+            def f():
+                yield 4 + ""
+            self.fixtype(' ').join(f())
+        except TypeError, e:
+            if '+' not in str(e):
+                self.fail('join() ate exception message')
+        else:
+            self.fail('exception not raised')
 
     def test_formatting(self):
         self.checkequal('+hello+', '+%s+', '__mod__', 'hello')



More information about the Python-checkins mailing list