diff options
| author | Victor Stinner <victor.stinner@haypocalc.com> | 2010-05-05 12:40:49 (GMT) |
|---|---|---|
| committer | Victor Stinner <victor.stinner@haypocalc.com> | 2010-05-05 12:40:49 (GMT) |
| commit | 926fd4ee32de00ddb44df111f830678e2bcc6524 (patch) | |
| tree | a6e5cda549defe46bae0ff2e520b09fd2c7c81ac /Lib/test/test_traceback.py | |
| parent | f3c157f639f3da24ccfc532aabe01af1ba0111c5 (diff) | |
| download | cpython-926fd4ee32de00ddb44df111f830678e2bcc6524.zip cpython-926fd4ee32de00ddb44df111f830678e2bcc6524.tar.gz cpython-926fd4ee32de00ddb44df111f830678e2bcc6524.tar.bz2 | |
Issue #8313: traceback.format_exception_only() encodes unicode message to
ASCII with backslashreplace error handler if str(value) failed
Diffstat (limited to 'Lib/test/test_traceback.py')
| -rw-r--r-- | Lib/test/test_traceback.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py index c79961e..811feac 100644 --- a/Lib/test/test_traceback.py +++ b/Lib/test/test_traceback.py @@ -159,6 +159,15 @@ def test(): err = traceback.format_exception_only(None, None) self.assertEqual(err, ['None\n']) + def test_unicode(self): + err = AssertionError('\xff') + lines = traceback.format_exception_only(type(err), err) + self.assertEqual(lines, ['AssertionError: \xff\n']) + + err = AssertionError(u'\xe9') + lines = traceback.format_exception_only(type(err), err) + self.assertEqual(lines, ['AssertionError: \\xe9\n']) + class TracebackFormatTests(unittest.TestCase): |
