@@ -686,7 +686,7 @@ class TestOptionalsChoices(ParserTestCase):
686686 argument_signatures = [
687687 Sig ('-f' , choices = 'abc' ),
688688 Sig ('-g' , type = int , choices = range (5 ))]
689- failures = ['a' , '-f d' , '-fad' , '-ga' , '-g 6' ]
689+ failures = ['a' , '-f d' , '-f ab' , '- fad' , '-ga' , '-g 6' ]
690690 successes = [
691691 ('' , NS (f = None , g = None )),
692692 ('-f a' , NS (f = 'a' , g = None )),
@@ -2270,14 +2270,14 @@ def _get_parser(self, subparser_help=False, prefix_chars=None,
22702270 parser1_kwargs ['aliases' ] = ['1alias1' , '1alias2' ]
22712271 parser1 = subparsers .add_parser ('1' , ** parser1_kwargs )
22722272 parser1 .add_argument ('-w' , type = int , help = 'w help' )
2273- parser1 .add_argument ('x' , choices = 'abc' , help = 'x help' )
2273+ parser1 .add_argument ('x' , choices = [ 'a' , 'b' , 'c' ] , help = 'x help' )
22742274
22752275 # add second sub-parser
22762276 parser2_kwargs = dict (description = '2 description' )
22772277 if subparser_help :
22782278 parser2_kwargs ['help' ] = '2 help'
22792279 parser2 = subparsers .add_parser ('2' , ** parser2_kwargs )
2280- parser2 .add_argument ('-y' , choices = '123' , help = 'y help' )
2280+ parser2 .add_argument ('-y' , choices = [ '1' , '2' , '3' ] , help = 'y help' )
22812281 parser2 .add_argument ('z' , type = complex , nargs = '*' , help = 'z help' )
22822282
22832283 # add third sub-parser
@@ -4618,7 +4618,7 @@ class TestHelpVariableExpansion(HelpTestCase):
46184618 help = 'x %(prog)s %(default)s %(type)s %%' ),
46194619 Sig ('-y' , action = 'store_const' , default = 42 , const = 'XXX' ,
46204620 help = 'y %(prog)s %(default)s %(const)s' ),
4621- Sig ('--foo' , choices = 'abc' ,
4621+ Sig ('--foo' , choices = [ 'a' , 'b' , 'c' ] ,
46224622 help = 'foo %(prog)s %(default)s %(choices)s' ),
46234623 Sig ('--bar' , default = 'baz' , choices = [1 , 2 ], metavar = 'BBB' ,
46244624 help = 'bar %(prog)s %(default)s %(dest)s' ),
@@ -5281,7 +5281,7 @@ def test_no_argument_actions(self):
52815281 for action in ['store_const' , 'store_true' , 'store_false' ,
52825282 'append_const' , 'count' ]:
52835283 for attrs in [dict (type = int ), dict (nargs = '+' ),
5284- dict (choices = 'ab' )]:
5284+ dict (choices = [ 'a' , 'b' ] )]:
52855285 self .assertTypeError ('-x' , action = action , ** attrs )
52865286
52875287 def test_no_argument_no_const_actions (self ):
0 commit comments