mirror of
https://github.com/python/cpython.git
synced 2025-08-28 20:56:54 +00:00
gh-92445 Improve interaction between nargs="*" and choices() (GH-92565)
This commit is contained in:
parent
cd492d43a2
commit
ad7340e8c5
3 changed files with 13 additions and 1 deletions
|
@ -5230,6 +5230,13 @@ class TestParseKnownArgs(TestCase):
|
|||
self.assertEqual(NS(v=3, spam=True, badger="B"), args)
|
||||
self.assertEqual(["C", "--foo", "4"], extras)
|
||||
|
||||
def test_zero_or_more_optional(self):
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('x', nargs='*', choices=('x', 'y'))
|
||||
args = parser.parse_args([])
|
||||
self.assertEqual(NS(x=[]), args)
|
||||
|
||||
|
||||
# ===========================
|
||||
# parse_intermixed_args tests
|
||||
# ===========================
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue