@@ -1937,23 +1937,25 @@ def test_required_subparsers_default(self):
1937
1937
def test_required_subparsers_no_destination_error (self ):
1938
1938
parser = ErrorRaisingArgumentParser ()
1939
1939
subparsers = parser .add_subparsers ()
1940
- subparsers .add_parser ('run' )
1940
+ subparsers .add_parser ('foo' )
1941
+ subparsers .add_parser ('bar' )
1941
1942
with self .assertRaises (ArgumentParserError ) as excinfo :
1942
1943
parser .parse_args (())
1943
1944
self .assertRegex (
1944
1945
excinfo .exception .stderr ,
1945
- 'error: the following arguments are required: {run }\n $'
1946
+ 'error: the following arguments are required: {foo,bar }\n $'
1946
1947
)
1947
1948
1948
1949
def test_wrong_argument_subparsers_no_destination_error (self ):
1949
1950
parser = ErrorRaisingArgumentParser ()
1950
1951
subparsers = parser .add_subparsers ()
1951
1952
subparsers .add_parser ('foo' )
1953
+ subparsers .add_parser ('bar' )
1952
1954
with self .assertRaises (ArgumentParserError ) as excinfo :
1953
- parser .parse_args (('bar ' ,))
1955
+ parser .parse_args (('baz ' ,))
1954
1956
self .assertRegex (
1955
1957
excinfo .exception .stderr ,
1956
- r"error: argument {foo}: invalid choice: 'bar ' \(choose from 'foo'\)\n$"
1958
+ r"error: argument {foo,bar }: invalid choice: 'baz ' \(choose from 'foo', 'bar '\)\n$"
1957
1959
)
1958
1960
1959
1961
def test_optional_subparsers (self ):
0 commit comments