Skip to content

Commit

Permalink
Make tests more strict.
Browse files Browse the repository at this point in the history
  • Loading branch information
serhiy-storchaka committed Sep 24, 2024
1 parent 00ea90f commit a44612d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Lib/test/test_argparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -6355,28 +6355,28 @@ def test_required_args(self):
self.parser.add_argument('bar')
self.parser.add_argument('baz')
self.assertRaisesRegex(argparse.ArgumentError,
'the following arguments are required: bar, baz',
'the following arguments are required: bar, baz$',
self.parser.parse_args, [])

def test_required_args_optional(self):
self.parser.add_argument('bar')
self.parser.add_argument('baz', nargs='?')
self.assertRaisesRegex(argparse.ArgumentError,
'the following arguments are required: bar',
'the following arguments are required: bar$',
self.parser.parse_args, [])

def test_required_args_zero_or_more(self):
self.parser.add_argument('bar')
self.parser.add_argument('baz', nargs='*')
self.assertRaisesRegex(argparse.ArgumentError,
'the following arguments are required: bar',
'the following arguments are required: bar$',
self.parser.parse_args, [])

def test_required_args_remainder(self):
self.parser.add_argument('bar')
self.parser.add_argument('baz', nargs='...')
self.assertRaisesRegex(argparse.ArgumentError,
'the following arguments are required: bar',
'the following arguments are required: bar$',
self.parser.parse_args, [])

def test_required_mutually_exclusive_args(self):
Expand Down

0 comments on commit a44612d

Please sign in to comment.