mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-30878: Fix error message when keyword arguments are passed (#2635)
to staticmethod() and classmethod().
This commit is contained in:
parent
aa6a4d6ed8
commit
9648088e6c
2 changed files with 12 additions and 4 deletions
|
@ -186,6 +186,14 @@ class CFunctionCallsErrorMessages(unittest.TestCase):
|
|||
msg = r"^pack\(\) takes no keyword arguments$"
|
||||
self.assertRaisesRegex(TypeError, msg, struct.Struct.pack, struct.Struct(""), x=2)
|
||||
|
||||
def test_varargs12_kw(self):
|
||||
msg = r"^staticmethod\(\) takes no keyword arguments$"
|
||||
self.assertRaisesRegex(TypeError, msg, staticmethod, func=id)
|
||||
|
||||
def test_varargs13_kw(self):
|
||||
msg = r"^classmethod\(\) takes no keyword arguments$"
|
||||
self.assertRaisesRegex(TypeError, msg, classmethod, func=id)
|
||||
|
||||
def test_oldargs0_1(self):
|
||||
msg = r"keys\(\) takes no arguments \(1 given\)"
|
||||
self.assertRaisesRegex(TypeError, msg, {}.keys, 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue