File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -524,6 +524,8 @@ def _GetArgDefault(flag, spec):
524524 for arg , default in zip (args_with_defaults , spec .defaults ):
525525 if arg == flag :
526526 return repr (default )
527+ if flag in spec .kwonlydefaults :
528+ return repr (spec .kwonlydefaults [flag ])
527529 return ''
528530
529531
Original file line number Diff line number Diff line change @@ -296,6 +296,18 @@ def testHelpTextKeywordOnlyArgumentsWithoutDefault(self):
296296 self .assertIn ('NAME\n double' , output )
297297 self .assertIn ('FLAGS\n --count=COUNT (required)' , output )
298298
299+ @testutils .skipIf (
300+ six .PY2 ,
301+ 'Python 2 does not support required name-only arguments.' )
302+ def testHelpTextFunctionMixedDefaults (self ):
303+ component = tc .py3 .HelpTextComponent ().identity
304+ t = trace .FireTrace (component , name = 'FunctionMixedDefaults' )
305+ output = helptext .HelpText (component , trace = t )
306+ self .assertIn ('NAME\n FunctionMixedDefaults' , output )
307+ self .assertIn ('FunctionMixedDefaults <flags>' , output )
308+ self .assertIn ('--alpha=ALPHA (required)' , output )
309+ self .assertIn ('--beta=BETA\n Default: \' 0\' ' , output )
310+
299311 def testHelpScreen (self ):
300312 component = tc .ClassWithDocstring ()
301313 t = trace .FireTrace (component , name = 'ClassWithDocstring' )
You can’t perform that action at this time.
0 commit comments