from io import StringIO
import linecache
import sys
+import inspect
import unittest
import re
from test import support
self.assertEqual(
traceback.format_exception_only(None, None), [NONE_EXC_STRING])
+ def test_signatures(self):
+ self.assertEqual(
+ str(inspect.signature(traceback.print_exception)),
+ ('(exc, /, value=<implicit>, tb=<implicit>, '
+ 'limit=None, file=None, chain=True)'))
+
+ self.assertEqual(
+ str(inspect.signature(traceback.format_exception)),
+ ('(exc, /, value=<implicit>, tb=<implicit>, limit=None, '
+ 'chain=True)'))
+
+ self.assertEqual(
+ str(inspect.signature(traceback.format_exception_only)),
+ '(exc, /, value=<implicit>)')
+
class TracebackFormatTests(unittest.TestCase):
"another exception occurred:\n\n")
-_sentinel = object()
+class _Sentinel:
+ def __repr__(self):
+ return "<implicit>"
+_sentinel = _Sentinel()
def _parse_value_tb(exc, value, tb):
if (value is _sentinel) != (tb is _sentinel):