parameters_ex = (param,)
break
else:
- msg = 'missing a required argument: {arg!r}'
- msg = msg.format(arg=param.name)
+ if param.kind == _KEYWORD_ONLY:
+ argtype = ' keyword-only'
+ else:
+ argtype = ''
+ msg = 'missing a required{argtype} argument: {arg!r}'
+ msg = msg.format(arg=param.name, argtype=argtype)
raise TypeError(msg) from None
else:
# We have a positional argument to process
self.call(test, 1, bar=2, spam='ham')
with self.assertRaisesRegex(TypeError,
- "missing a required argument: 'bar'"):
+ "missing a required keyword-only "
+ "argument: 'bar'"):
self.call(test, 1)
def test(foo, *, bar, **bin):