mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
gh-59330: Improve error message for dest= for positionals (GH-125215)
Also improve the documentation. Specify how dest and metavar are derived from add_argument() positional arguments. Co-authored-by: Simon Law <sfllaw@sfllaw.ca>
This commit is contained in:
parent
eb2d268ac7
commit
a6c0c64de0
3 changed files with 23 additions and 2 deletions
|
@ -5411,7 +5411,8 @@ class TestInvalidArgumentConstructors(TestCase):
|
|||
parser.add_argument(dest='foo')
|
||||
with self.assertRaises(ValueError) as cm:
|
||||
parser.add_argument('bar', dest='baz')
|
||||
self.assertIn('dest supplied twice for positional argument',
|
||||
self.assertIn('dest supplied twice for positional argument,'
|
||||
' did you mean metavar?',
|
||||
str(cm.exception))
|
||||
|
||||
def test_no_argument_actions(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue