@@ -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 )),
@@ -2291,14 +2291,14 @@ def _get_parser(self, subparser_help=False, prefix_chars=None,
22912291 parser1_kwargs ['aliases' ] = ['1alias1' , '1alias2' ]
22922292 parser1 = subparsers .add_parser ('1' , ** parser1_kwargs )
22932293 parser1 .add_argument ('-w' , type = int , help = 'w help' )
2294- parser1 .add_argument ('x' , choices = 'abc' , help = 'x help' )
2294+ parser1 .add_argument ('x' , choices = [ 'a' , 'b' , 'c' ] , help = 'x help' )
22952295
22962296 # add second sub-parser
22972297 parser2_kwargs = dict (description = '2 description' )
22982298 if subparser_help :
22992299 parser2_kwargs ['help' ] = '2 help'
23002300 parser2 = subparsers .add_parser ('2' , ** parser2_kwargs )
2301- parser2 .add_argument ('-y' , choices = '123' , help = 'y help' )
2301+ parser2 .add_argument ('-y' , choices = [ '1' , '2' , '3' ] , help = 'y help' )
23022302 parser2 .add_argument ('z' , type = complex , nargs = '*' , help = 'z help' )
23032303
23042304 # add third sub-parser
@@ -4628,7 +4628,7 @@ class TestHelpVariableExpansion(HelpTestCase):
46284628 help = 'x %(prog)s %(default)s %(type)s %%' ),
46294629 Sig ('-y' , action = 'store_const' , default = 42 , const = 'XXX' ,
46304630 help = 'y %(prog)s %(default)s %(const)s' ),
4631- Sig ('--foo' , choices = 'abc' ,
4631+ Sig ('--foo' , choices = [ 'a' , 'b' , 'c' ] ,
46324632 help = 'foo %(prog)s %(default)s %(choices)s' ),
46334633 Sig ('--bar' , default = 'baz' , choices = [1 , 2 ], metavar = 'BBB' ,
46344634 help = 'bar %(prog)s %(default)s %(dest)s' ),
@@ -5291,7 +5291,7 @@ def test_no_argument_actions(self):
52915291 for action in ['store_const' , 'store_true' , 'store_false' ,
52925292 'append_const' , 'count' ]:
52935293 for attrs in [dict (type = int ), dict (nargs = '+' ),
5294- dict (choices = 'ab' )]:
5294+ dict (choices = [ 'a' , 'b' ] )]:
52955295 self .assertTypeError ('-x' , action = action , ** attrs )
52965296
52975297 def test_no_argument_no_const_actions (self ):
0 commit comments