@@ -602,18 +602,13 @@ choices (if specified) or subparser names, along with a "maybe you meant"
602602suggestion if a close match is found. Note that this only applies for arguments
603603when the choices specified are strings::
604604
605- >>> parser = argparse.ArgumentParser(description='Process some integers.',
606- suggest_on_error=True)
607- >>> parser.add_argument('--action', choices=['sum', 'max'])
608- >>> parser.add_argument('integers', metavar='N', type=int, nargs='+',
609- ... help='an integer for the accumulator')
610- >>> parser.parse_args(['--action', 'sumn', 1, 2, 3])
611- tester.py: error: argument --action: invalid choice: 'sumn', maybe you meant 'sum'? (choose from 'sum', 'max')
612-
613- You can disable suggestions by setting ``suggest_on_error `` to ``False ``::
605+ >>> parser = argparse.ArgumentParser(suggest_on_error=True)
606+ >>> parser.add_argument('--action', choices=['debug', 'dryrun'])
607+ >>> parser.parse_args(['--action', 'debugg'])
608+ usage: tester.py [-h] [--action {debug,dryrun}]
609+ tester.py: error: argument --action: invalid choice: 'debugg', maybe you meant 'debug'? (choose from debug, dryrun)
614610
615- >>> parser = argparse.ArgumentParser(description='Process some integers.',
616- suggest_on_error=False)
611+ You can disable suggestions by setting ``suggest_on_error `` to ``False ``.
617612
618613.. versionadded :: 3.14
619614.. versionchanged :: 3.15
0 commit comments