bpo-40679: Use the function's qualname in certain TypeErrors (GH-20236)

Patch by Dennis Sweeney.
This commit is contained in:
Dennis Sweeney 2020-05-22 16:40:17 -04:00 committed by GitHub
parent 7c30d12bd5
commit b5cc2089cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 68 additions and 16 deletions

View file

@ -63,7 +63,8 @@ class KeywordOnlyArgTestCase(unittest.TestCase):
pass
with self.assertRaises(TypeError) as exc:
f(1, 2, 3)
expected = "f() takes from 1 to 2 positional arguments but 3 were given"
expected = (f"{f.__qualname__}() takes from 1 to 2 "
"positional arguments but 3 were given")
self.assertEqual(str(exc.exception), expected)
def testSyntaxErrorForFunctionCall(self):