Inspired by SF patch #860326, make the exception formatting by
traceback.py be closer to the built-in formatting.
A few unittests had to be fixed, too.
diff --git a/Lib/test/test_doctest.py b/Lib/test/test_doctest.py
index 12d75dd..1390e15 100644
--- a/Lib/test/test_doctest.py
+++ b/Lib/test/test_doctest.py
@@ -2234,7 +2234,7 @@
>>> doctest.testfile('test_doctest.txt', raise_on_error=True)
... # doctest: +ELLIPSIS
Traceback (most recent call last):
- UnexpectedException: ...
+ doctest.UnexpectedException: ...
>>> doctest.master = None # Reset master.
If the tests contain non-ASCII characters, the tests might fail, since
diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py
index 6f9e464..9ba1dca 100644
--- a/Lib/test/test_traceback.py
+++ b/Lib/test/test_traceback.py
@@ -118,7 +118,9 @@
err = traceback.format_exception_only(X, X())
self.assertEqual(len(err), 1)
str_value = '<unprintable %s object>' % X.__name__
- self.assertEqual(err[0], X.__name__ + ': ' + str_value + '\n')
+ self.assertEqual(err[0], "%s.%s: %s\n" % (X.__module__,
+ X.__name__,
+ str_value))
def test_main():
diff --git a/Lib/test/test_unpack.py b/Lib/test/test_unpack.py
index 3f72648..cd48689 100644
--- a/Lib/test/test_unpack.py
+++ b/Lib/test/test_unpack.py
@@ -107,7 +107,7 @@
>>> a, b, c, d, e = BadSeq()
Traceback (most recent call last):
...
- BozoError
+ test.test_unpack.BozoError
Trigger code while expecting an IndexError (unpack sequence too short, wrong
error)
@@ -115,7 +115,7 @@
>>> a, b, c = BadSeq()
Traceback (most recent call last):
...
- BozoError
+ test.test_unpack.BozoError
"""