@@ -1045,7 +1045,7 @@ def test_invalid_enum_value_raises_error(self):
10451045 parser .add_argument ('--color' , choices = self .Color )
10461046 self .assertRaisesRegex (
10471047 argparse .ArgumentError ,
1048- r"invalid choice: 'yellow' \(choose from red, green, blue\)" ,
1048+ r"invalid choice: 'yellow' \(choose from ' red', ' green', ' blue' \)" ,
10491049 parser .parse_args ,
10501050 ['--color' , 'yellow' ],
10511051 )
@@ -2313,7 +2313,7 @@ def test_wrong_argument_error_with_suggestions(self):
23132313 with self .assertRaises (ArgumentParserError ) as excinfo :
23142314 parser .parse_args (('bazz' ,))
23152315 self .assertIn (
2316- "error: argument foo: invalid choice: 'bazz', maybe you meant 'baz'? (choose from bar, baz)" ,
2316+ "error: argument foo: invalid choice: 'bazz', maybe you meant 'baz'? (choose from ' bar', ' baz' )" ,
23172317 excinfo .exception .stderr
23182318 )
23192319
@@ -2323,7 +2323,7 @@ def test_wrong_argument_error_no_suggestions(self):
23232323 with self .assertRaises (ArgumentParserError ) as excinfo :
23242324 parser .parse_args (('bazz' ,))
23252325 self .assertIn (
2326- "error: argument foo: invalid choice: 'bazz' (choose from bar, baz)" ,
2326+ "error: argument foo: invalid choice: 'bazz' (choose from ' bar', ' baz' )" ,
23272327 excinfo .exception .stderr ,
23282328 )
23292329
@@ -2336,7 +2336,7 @@ def test_wrong_argument_subparsers_with_suggestions(self):
23362336 parser .parse_args (('baz' ,))
23372337 self .assertIn (
23382338 "error: argument {foo,bar}: invalid choice: 'baz', maybe you meant"
2339- " 'bar'? (choose from foo, bar)" ,
2339+ " 'bar'? (choose from ' foo', ' bar' )" ,
23402340 excinfo .exception .stderr ,
23412341 )
23422342
@@ -2348,7 +2348,7 @@ def test_wrong_argument_subparsers_no_suggestions(self):
23482348 with self .assertRaises (ArgumentParserError ) as excinfo :
23492349 parser .parse_args (('baz' ,))
23502350 self .assertIn (
2351- "error: argument {foo,bar}: invalid choice: 'baz' (choose from foo, bar)" ,
2351+ "error: argument {foo,bar}: invalid choice: 'baz' (choose from ' foo', ' bar' )" ,
23522352 excinfo .exception .stderr ,
23532353 )
23542354
@@ -2358,7 +2358,7 @@ def test_wrong_argument_no_suggestion_implicit(self):
23582358 with self .assertRaises (ArgumentParserError ) as excinfo :
23592359 parser .parse_args (('bazz' ,))
23602360 self .assertIn (
2361- "error: argument foo: invalid choice: 'bazz' (choose from bar, baz)" ,
2361+ "error: argument foo: invalid choice: 'bazz' (choose from ' bar', ' baz' )" ,
23622362 excinfo .exception .stderr ,
23632363 )
23642364
@@ -2378,7 +2378,7 @@ def test_suggestions_choices_int(self):
23782378 with self .assertRaises (ArgumentParserError ) as excinfo :
23792379 parser .parse_args (('3' ,))
23802380 self .assertIn (
2381- "error: argument foo: invalid choice: '3' (choose from 1, 2 )" ,
2381+ "error: argument foo: invalid choice: '3' (choose from '1', '2' )" ,
23822382 excinfo .exception .stderr ,
23832383 )
23842384
@@ -2388,7 +2388,7 @@ def test_suggestions_choices_mixed_types(self):
23882388 with self .assertRaises (ArgumentParserError ) as excinfo :
23892389 parser .parse_args (('3' ,))
23902390 self .assertIn (
2391- "error: argument foo: invalid choice: '3' (choose from 1, 2 )" ,
2391+ "error: argument foo: invalid choice: '3' (choose from '1', '2' )" ,
23922392 excinfo .exception .stderr ,
23932393 )
23942394
0 commit comments