summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_argparse.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2024-10-12 11:46:28 (GMT)
committerGitHub <noreply@github.com>2024-10-12 11:46:28 (GMT)
commita6c0c64de0ade400df7995f1e9480b6fc0f863aa (patch)
treed48eb4b42b7f9c0e04bd15fe4c4105b7694a2ce3 /Lib/test/test_argparse.py
parenteb2d268ac7480b5e2b4ffb9a644cad7ac75ae954 (diff)
downloadcpython-a6c0c64de0ade400df7995f1e9480b6fc0f863aa.zip
cpython-a6c0c64de0ade400df7995f1e9480b6fc0f863aa.tar.gz
cpython-a6c0c64de0ade400df7995f1e9480b6fc0f863aa.tar.bz2
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>
Diffstat (limited to 'Lib/test/test_argparse.py')
-rw-r--r--Lib/test/test_argparse.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/test/test_argparse.py b/Lib/test/test_argparse.py
index 000b810..61ddb5f 100644
--- a/Lib/test/test_argparse.py
+++ b/Lib/test/test_argparse.py
@@ -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):