diff options
author | Brett Cannon <bcannon@gmail.com> | 2006-09-09 07:11:46 +0000 |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2006-09-09 07:11:46 +0000 |
commit | ca2ca79d23645eb2ee457f64506d05f232c673c9 (patch) | |
tree | 674299e348769d9b15b109e1434b1398d048fd8b /Lib/test/test_exceptions.py | |
parent | af57f6065f2131dad699667c11fdc9520a84986b (diff) | |
download | cpython-git-ca2ca79d23645eb2ee457f64506d05f232c673c9.tar.gz |
Remove the __unicode__ method from exceptions. Allows unicode() to be called
on exception classes. Would require introducing a tp_unicode slot to make it
work otherwise.
Fixes bug #1551432 and will be backported.
Diffstat (limited to 'Lib/test/test_exceptions.py')
-rw-r--r-- | Lib/test/test_exceptions.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py index af07aa8aa9..27d88a0fd5 100644 --- a/Lib/test/test_exceptions.py +++ b/Lib/test/test_exceptions.py @@ -304,6 +304,15 @@ class ExceptionTests(unittest.TestCase): return -1 self.assertRaises(RuntimeError, g) + def testUnicodeStrUsage(self): + # Make sure both instances and classes have a str and unicode + # representation. + self.failUnless(str(Exception)) + self.failUnless(unicode(Exception)) + self.failUnless(str(Exception('a'))) + self.failUnless(unicode(Exception(u'a'))) + + def test_main(): run_unittest(ExceptionTests) |