8000 gh-101979: fix a bug that parentheses in metavar argument of add_argument() were dropped by yeojin-dev · Pull Request #102318 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-101979: fix a bug that parentheses in metavar argument of add_argument() were dropped #102318

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Mar 5, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix typo
  • Loading branch information
yeojin-dev committed Feb 28, 2023
commit 7f828633d2fa469ad6d0e955640b21341cc76cf6
2 changes: 1 addition & 1 deletion Lib/test/test_argparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -3764,7 +3764,7 @@ class TestHelpUsage(HelpTestCase):
version = ''


class TestHelpUsageWithParenthesis(HelpTestCase):
class TestHelpUsageWithParentheses(HelpTestCase):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any tests that actually add parentheses for a group with more than one action. Could you add one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good idea. But I think the testcase you want already exists using the code below. Please review it.

usage: PROG [-h] (--bar BAR | --baz [BAZ])

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, thanks! There are a lot of tests, I must have glanced over that one.

parser_signature = Sig(prog='PROG')
argument_signatures = [
Sig('positional', metavar='(example) positional'),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Fix a bug that parentheses in metavar param of :func:`add_argument()` were
Fix a bug that parentheses in metavar argument of :func:`add_argument()` were
dropped. Patch by Yeojin Kim.
0