diff options
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/string_tests.py | 9 | ||||
-rw-r--r-- | Lib/test/test_string.py | 11 |
2 files changed, 20 insertions, 0 deletions
diff --git a/Lib/test/string_tests.py b/Lib/test/string_tests.py index 9f092b9..60f5fdb 100644 --- a/Lib/test/string_tests.py +++ b/Lib/test/string_tests.py @@ -657,6 +657,15 @@ class MixinStrUnicodeUserStringTest: 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') diff --git a/Lib/test/test_string.py b/Lib/test/test_string.py index d80c3b6..fdd431d 100644 --- a/Lib/test/test_string.py +++ b/Lib/test/test_string.py @@ -51,6 +51,17 @@ class StringTest( 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): |