8000 gh-132717: `argparse`: Call the convert function for default values of variadic arguments by noamcohen97 · Pull Request #132724 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-132717: argparse: Call the convert function for default values of variadic arguments #132724

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
Next Next commit
add test cases
  • Loading branch information
noamcohen97 committed Apr 19, 2025
commit e071225c0fa6c20760e3cd500236434cfc6abc82
19 changes: 19 additions & 0 deletions Lib/test/test_argparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,25 @@ class TestOptionalsNargsDefault(ParserTestCase):
('-x a', NS(x='a')),
]

class TestNargsDefaultConvert(ParserTestCase):
"""Tests not specifying the number of args for an Optional"""

argument_signatures = [Sig('-x', type=int, nargs='+', default=['1', '2'])]
failures = []
successes = [
('', NS(x=[1, 2])),
]


class TestListDefaultConvert(ParserTestCase):
"""Tests not specifying the number of args for an Optional"""

argument_signatures = [Sig('-x', type=int, default=['1', '2'])]
failures = []
successes = [
('', NS(x=['1', '2'])),
]


class TestOptionalsNargs1(ParserTestCase):
"""Tests specifying 1 arg for an Optional"""
Expand Down
0