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.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py
index f4161fb..602bd2c 100644
--- a/Lib/test/test_traceback.py
+++ b/Lib/test/test_traceback.py
@@ -2279,6 +2279,9 @@ class TestStack(unittest.TestCase):
f' File "{__file__}", line {lno}, in f\n 1/0\n'
)
+class Unrepresentable:
+ def __repr__(self) -> str:
+ raise Exception("Unrepresentable")
class TestTracebackException(unittest.TestCase):
@@ -2546,12 +2549,13 @@ class TestTracebackException(unittest.TestCase):
linecache.updatecache('/foo.py', globals())
e = Exception("uh oh")
c = test_code('/foo.py', 'method')
- f = test_frame(c, globals(), {'something': 1, 'other': 'string'})
+ f = test_frame(c, globals(), {'something': 1, 'other': 'string', 'unrepresentable': Unrepresentable()})
tb = test_tb(f, 6, None, 0)
exc = traceback.TracebackException(
Exception, e, tb, capture_locals=True)
self.assertEqual(
- exc.stack[0].locals, {'something': '1', 'other': "'string'"})
+ exc.stack[0].locals,
+ {'something': '1', 'other': "'string'", 'unrepresentable': '<local repr() failed>'})
def test_no_locals(self):
linecache.updatecache('/foo.py', globals())