summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_traceback.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-06-17 16:41:46 (GMT)
committerGitHub <noreply@github.com>2021-06-17 16:41:46 (GMT)
commiteb0a6801bef4f68eebf6fdb2b7a32c32a5b6c983 (patch)
treed4daad3320ea6760814e16a45ec174fc152b7c31 /Lib/test/test_traceback.py
parent4f71b0199bfd4d83a01bf660a4650307cdc7c089 (diff)
downloadcpython-eb0a6801bef4f68eebf6fdb2b7a32c32a5b6c983.zip
cpython-eb0a6801bef4f68eebf6fdb2b7a32c32a5b6c983.tar.gz
cpython-eb0a6801bef4f68eebf6fdb2b7a32c32a5b6c983.tar.bz2
bpo-43024: improve signature (in help, etc) for functions taking sent… (GH-24331) (GH-26773)
…inel defaults (cherry picked from commit f73377d57c5272390de63cccc3c292c44689310a) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Diffstat (limited to 'Lib/test/test_traceback.py')
-rw-r--r--Lib/test/test_traceback.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py
index 5bd969d..dd94590 100644
--- a/Lib/test/test_traceback.py
+++ b/Lib/test/test_traceback.py
@@ -4,6 +4,7 @@ from collections import namedtuple
from io import StringIO
import linecache
import sys
+import inspect
import unittest
import re
from test import support
@@ -255,6 +256,21 @@ class TracebackCases(unittest.TestCase):
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):