@@ -1123,7 +1123,7 @@ def test_invalid_enum_value_raises_error(self):
11231123 parser .add_argument ('--color' , choices = self .Color )
11241124 self .assertRaisesRegex (
11251125 argparse .ArgumentError ,
1126- r"invalid choice: 'yellow' \(choose from red, green, blue\)" ,
1126+ r"invalid choice: 'yellow' \(choose from ' red', ' green', ' blue' \)" ,
11271127 parser .parse_args ,
11281128 ['--color' , 'yellow' ],
11291129 )
@@ -2392,7 +2392,7 @@ def test_wrong_argument_error_with_suggestions(self):
23922392 with self .assertRaises (ArgumentParserError ) as excinfo :
23932393 parser .parse_args (('bazz' ,))
23942394 self .assertIn (
2395- "error: argument foo: invalid choice: 'bazz', maybe you meant 'baz'? (choose from bar, baz)" ,
2395+ "error: argument foo: invalid choice: 'bazz', maybe you meant 'baz'? (choose from ' bar', ' baz' )" ,
23962396 excinfo .exception .stderr
23972397 )
23982398
@@ -2402,7 +2402,7 @@ def test_wrong_argument_error_no_suggestions(self):
24022402 with self .assertRaises (ArgumentParserError ) as excinfo :
24032403 parser .parse_args (('bazz' ,))
24042404 self .assertIn (
2405- "error: argument foo: invalid choice: 'bazz' (choose from bar, baz)" ,
2405+ "error: argument foo: invalid choice: 'bazz' (choose from ' bar', ' baz' )" ,
24062406 excinfo .exception .stderr ,
24072407 )
24082408
@@ -2415,7 +2415,7 @@ def test_wrong_argument_subparsers_with_suggestions(self):
24152415 parser .parse_args (('baz' ,))
24162416 self .assertIn (
24172417 "error: argument {foo,bar}: invalid choice: 'baz', maybe you meant"
2418- " 'bar'? (choose from foo, bar)" ,
2418+ " 'bar'? (choose from ' foo', ' bar' )" ,
24192419 excinfo .exception .stderr ,
24202420 )
24212421
@@ -2427,7 +2427,7 @@ def test_wrong_argument_subparsers_no_suggestions(self):
24272427 with self .assertRaises (ArgumentParserError ) as excinfo :
24282428 parser .parse_args (('baz' ,))
24292429 self .assertIn (
2430- "error: argument {foo,bar}: invalid choice: 'baz' (choose from foo, bar)" ,
2430+ "error: argument {foo,bar}: invalid choice: 'baz' (choose from ' foo', ' bar' )" ,
24312431 excinfo .exception .stderr ,
24322432 )
24332433
@@ -2438,7 +2438,7 @@ def test_wrong_argument_with_suggestion_explicit(self):
24382438 parser .parse_args (('bazz' ,))
24392439 self .assertIn (
24402440 "error: argument foo: invalid choice: 'bazz', maybe you meant"
2441- " 'baz'? (choose from bar, baz)" ,
2441+ " 'baz'? (choose from ' bar', ' baz' )" ,
24422442 excinfo .exception .stderr ,
24432443 )
24442444
@@ -2468,7 +2468,7 @@ def test_suggestions_choices_mixed_types(self):
24682468 with self .assertRaises (ArgumentParserError ) as excinfo :
24692469 parser .parse_args (('3' ,))
24702470 self .assertIn (
2471- "error: argument foo: invalid choice: '3' (choose from 1, 2 )" ,
2471+ "error: argument foo: invalid choice: '3' (choose from 1, '2' )" ,
24722472 excinfo .exception .stderr ,
24732473 )
24742474
0 commit comments