Skip to content

Commit a8185af

Browse files
committed
Make enabling suggest_on_error implicit in tests
This is done as explicit enablement will be the least common pattern now.
1 parent ce77c7a commit a8185af

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Lib/test/test_argparse.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2287,7 +2287,7 @@ class TestArgumentAndSubparserSuggestions(TestCase):
22872287
"""Test error handling and suggestion when a user makes a typo"""
22882288

22892289
def test_wrong_argument_error_with_suggestions(self):
2290-
parser = ErrorRaisingArgumentParser(suggest_on_error=True)
2290+
parser = ErrorRaisingArgumentParser()
22912291
parser.add_argument('foo', choices=['bar', 'baz'])
22922292
with self.assertRaises(ArgumentParserError) as excinfo:
22932293
parser.parse_args(('bazz',))
@@ -2307,7 +2307,7 @@ def test_wrong_argument_error_no_suggestions(self):
23072307
)
23082308

23092309
def test_wrong_argument_subparsers_with_suggestions(self):
2310-
parser = ErrorRaisingArgumentParser(suggest_on_error=True)
2310+
parser = ErrorRaisingArgumentParser()
23112311
subparsers = parser.add_subparsers(required=True)
23122312
subparsers.add_parser('foo')
23132313
subparsers.add_parser('bar')
@@ -2331,8 +2331,8 @@ def test_wrong_argument_subparsers_no_suggestions(self):
23312331
excinfo.exception.stderr,
23322332
)
23332333

2334-
def test_wrong_argument_with_suggestion_implicit(self):
2335-
parser = ErrorRaisingArgumentParser()
2334+
def test_wrong_argument_with_suggestion_explicit(self):
2335+
parser = ErrorRaisingArgumentParser(suggest_on_error=True)
23362336
parser.add_argument('foo', choices=['bar', 'baz'])
23372337
with self.assertRaises(ArgumentParserError) as excinfo:
23382338
parser.parse_args(('bazz',))
@@ -2343,7 +2343,7 @@ def test_wrong_argument_with_suggestion_implicit(self):
23432343
)
23442344

23452345
def test_suggestions_choices_empty(self):
2346-
parser = ErrorRaisingArgumentParser(suggest_on_error=True)
2346+
parser = ErrorRaisingArgumentParser()
23472347
parser.add_argument('foo', choices=[])
23482348
with self.assertRaises(ArgumentParserError) as excinfo:
23492349
parser.parse_args(('bazz',))
@@ -2353,7 +2353,7 @@ def test_suggestions_choices_empty(self):
23532353
)
23542354

23552355
def test_suggestions_choices_int(self):
2356-
parser = ErrorRaisingArgumentParser(suggest_on_error=True)
2356+
parser = ErrorRaisingArgumentParser()
23572357
parser.add_argument('foo', choices=[1, 2])
23582358
with self.assertRaises(ArgumentParserError) as excinfo:
23592359
parser.parse_args(('3',))
@@ -2363,7 +2363,7 @@ def test_suggestions_choices_int(self):
23632363
)
23642364

23652365
def test_suggestions_choices_mixed_types(self):
2366-
parser = ErrorRaisingArgumentParser(suggest_on_error=True)
2366+
parser = ErrorRaisingArgumentParser()
23672367
parser.add_argument('foo', choices=[1, '2'])
23682368
with self.assertRaises(ArgumentParserError) as excinfo:
23692369
parser.parse_args(('3',))

0 commit comments

Comments
 (0)