if kwonlyargs:
for kwonlyarg in kwonlyargs:
spec = formatargandannotation(kwonlyarg)
- if kwonlyarg in kwonlydefaults:
+ if kwonlydefaults and kwonlyarg in kwonlydefaults:
spec += formatvalue(kwonlydefaults[kwonlyarg])
specs.append(spec)
if varkw is not None:
self.assertRaises(ValueError, self.assertArgSpecEquals,
mod2.annotated, [])
+ self.assertRaises(ValueError, self.assertArgSpecEquals,
+ mod2.keyword_only_arg, [])
+
def test_getfullargspec(self):
self.assertFullArgSpecEquals(mod2.keyworded, [], varargs_e='arg1',
self.assertFullArgSpecEquals(mod2.annotated, ['arg1'],
ann_e={'arg1' : list},
formatted='(arg1: list)')
+ self.assertFullArgSpecEquals(mod2.keyword_only_arg, [],
+ kwonlyargs_e=['arg'],
+ formatted='(*, arg)')
+
def test_getargspec_method(self):
class A(object):
Library
-------
+- Issue #4959: inspect.formatargspec now works for keyword only arguments
+ without defaults.
+
- Issue #3826 and #4791: The socket module now closes the underlying socket
appropriately when it is being used via socket.makefile() objects
rather than delaying the close by waiting for garbage collection to do it.