@@ -2063,23 +2063,25 @@ def test_required_subparsers_default(self):
2063
2063
def test_required_subparsers_no_destination_error (self ):
2064
2064
parser = ErrorRaisingArgumentParser ()
2065
2065
subparsers = parser .add_subparsers ()
2066
- subparsers .add_parser ('run' )
2066
+ subparsers .add_parser ('foo' )
2067
+ subparsers .add_parser ('bar' )
2067
2068
with self .assertRaises (ArgumentParserError ) as excinfo :
2068
2069
parser .parse_args (())
2069
2070
self .assertRegex (
2070
2071
excinfo .exception .stderr ,
2071
- 'error: the following arguments are required: {run }\n $'
2072
+ 'error: the following arguments are required: {foo,bar }\n $'
2072
2073
)
2073
2074
2074
2075
def test_wrong_argument_subparsers_no_destination_error (self ):
2075
2076
parser = ErrorRaisingArgumentParser ()
2076
2077
subparsers = parser .add_subparsers ()
2077
2078
subparsers .add_parser ('foo' )
2079
+ subparsers .add_parser ('bar' )
2078
2080
with self .assertRaises (ArgumentParserError ) as excinfo :
2079
- parser .parse_args (('bar ' ,))
2081
+ parser .parse_args (('baz ' ,))
2080
2082
self .assertRegex (
2081
2083
excinfo .exception .stderr ,
2082
- r"error: argument {foo}: invalid choice: 'bar ' \(choose from 'foo'\)\n$"
2084
+ r"error: argument {foo,bar }: invalid choice: 'baz ' \(choose from 'foo', 'bar '\)\n$"
2083
2085
)
2084
2086
2085
2087
def test_optional_subparsers (self ):
0 commit comments