Mercurial > cpython-lru_cache-weakref
diff Lib/test/test_argparse.py @ 79000:bc342cd7ed96 3.2
- Issue #15906: Fix a regression in argparse caused by the preceding change,
when action='append', type='str' and default=[].
| author | Barry Warsaw <barry@python.org> |
|---|---|
| date | Tue, 11 Sep 2012 22:38:47 -0400 |
| parents | 5d8454fcc629 |
| children | 088b16bd6396 25e41fdc4e60 |
line wrap: on
line diff
--- a/Lib/test/test_argparse.py Tue Sep 11 13:01:43 2012 -0400 +++ b/Lib/test/test_argparse.py Tue Sep 11 22:38:47 2012 -0400 @@ -4516,6 +4516,16 @@ 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 # ======================
