From c233b75147f01e8b34beb8ada6cec3468371c896 Mon Sep 17 00:00:00 2001 From: Kevin Van Brunt Date: Thu, 4 Jul 2019 15:22:01 -0400 Subject: Fixing unit tests --- examples/subcommands.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'examples/subcommands.py') diff --git a/examples/subcommands.py b/examples/subcommands.py index d1b7c9db..89bcaf85 100755 --- a/examples/subcommands.py +++ b/examples/subcommands.py @@ -33,8 +33,7 @@ bar_subparsers.add_parser('cranberries', help='cranberries help') # create the parser for the "sport" sub-command parser_sport = base_subparsers.add_parser('sport', help='sport help') -sport_arg = parser_sport.add_argument('sport', help='Enter name of a sport') -setattr(sport_arg, 'arg_choices', sport_item_strs) +sport_arg = parser_sport.add_argument('sport', help='Enter name of a sport', choices=sport_item_strs) # create the top-level parser for the alternate command @@ -60,8 +59,7 @@ bar2_subparsers.add_parser('cranberries', help='cranberries help') # create the parser for the "sport" sub-command parser_sport2 = base2_subparsers.add_parser('sport', help='sport help') -sport2_arg = parser_sport2.add_argument('sport', help='Enter name of a sport') -setattr(sport2_arg, 'arg_choices', sport_item_strs) +sport2_arg = parser_sport2.add_argument('sport', help='Enter name of a sport', choices=sport_item_strs) class SubcommandsExample(cmd2.Cmd): -- cgit v1.2.1