diff options
author | Barry Warsaw <barry@python.org> | 2012-09-12 01:06:29 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2012-09-12 01:06:29 (GMT) |
commit | 03fcfbef0aa9a0990d5cd3995defa8cd089f704c (patch) | |
tree | 056171792f9a71cc200050f7c8e90b9f68332d96 /Lib/test/test_argparse.py | |
parent | a8a5b397c1a30568be1309ed265b696da84eeca0 (diff) | |
download | cpython-03fcfbef0aa9a0990d5cd3995defa8cd089f704c.zip cpython-03fcfbef0aa9a0990d5cd3995defa8cd089f704c.tar.gz cpython-03fcfbef0aa9a0990d5cd3995defa8cd089f704c.tar.bz2 |
- Issue #15906: Fix a regression in argparse caused by the preceding change,
when action='append', type='str' and default=[].
Diffstat (limited to 'Lib/test/test_argparse.py')
-rw-r--r-- | Lib/test/test_argparse.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_argparse.py b/Lib/test/test_argparse.py index 99c1bab..c611944 100644 --- a/Lib/test/test_argparse.py +++ b/Lib/test/test_argparse.py @@ -4480,6 +4480,16 @@ class TestTypeFunctionCallWithNonStringDefault(TestCase): args = parser.parse_args([]) self.assertEqual(NS(foo='foo_converted'), args) + def test_issue_15906(self): + # Issue #15906: When action='append', type=str, default=[] are + # providing, the dest value was the string representation "[]" when it + # should have been an empty list. + parser = argparse.ArgumentParser() + parser.add_argument('--test', dest='test', type=str, + default=[], action='append') + args = parser.parse_args([]) + self.assertEqual(args.test, []) + # ====================== # parse_known_args tests # ====================== |