summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_traceback.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_traceback.py')
-rw-r--r--Lib/test/test_traceback.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py
index d1967aa..ee2896c 100644
--- a/Lib/test/test_traceback.py
+++ b/Lib/test/test_traceback.py
@@ -1171,6 +1171,19 @@ class BaseExceptionReportingTests:
exp = "\n".join(expected)
self.assertEqual(exp, err)
+ def test_format_exception_only_qualname(self):
+ class A:
+ class B:
+ class X(Exception):
+ def __str__(self):
+ return "I am X"
+ pass
+ err = self.get_report(A.B.X())
+ str_value = 'I am X'
+ str_name = '.'.join([A.B.X.__module__, A.B.X.__qualname__])
+ exp = "%s: %s\n" % (str_name, str_value)
+ self.assertEqual(exp, err)
+
class PyExcReportingTests(BaseExceptionReportingTests, unittest.TestCase):
#