[issue30592] Bad error message 'bool()() takes no keyword arguments'

SylvainDe report at bugs.python.org
Thu Jun 8 06:01:43 EDT 2017


SylvainDe added the comment:

As I was trying to test coverage for a few places where the same error was built, I have discovered another issue where the error message is very misleading:

 AssertionError: "^index\(\) takes no keyword arguments$" does not match "index() takes at least 1 argument (0 given)"
 def test_varargs4_kw(self):
     msg = r"^index\(\) takes no keyword arguments$"
     self.assertRaisesRegex(TypeError, msg, [].index, x=2)


Should I open another ticket to track this ?



Anyway, so far, I have reached the following conclusion regarding the test coverage:

Objects/call.c:551:                 "%.200s() takes no keyword arguments" => TESTED
(In _PyMethodDef_RawFastCallDict)

Objects/call.c:690:                 "%.200s() takes no keyword arguments" => Not tested
(In _PyMethodDef_RawFastCallKeywords)

Objects/call.c:737:            PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments" => Not tested
(In cfunction_call_varargs)


Python/getargs.c:2508:    PyErr_Format(PyExc_TypeError, "%.200s takes no keyword arguments" => TESTED (Now)
(In _PyArg_NoKeywords)

Python/getargs.c:2525:    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments" => Not tested
(In _PyArg_NoStackKeywords)


Any suggestion regarding how to test what is not tested is more than welcome.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30592>
_______________________________________


More information about the Python-bugs-list mailing list