This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author chris.jerdonek
Recipients Arfrever, arnau, barry, benjamin.peterson, bethard, chris.jerdonek, georg.brandl, python-dev, r.david.murray
Date 2012-09-12.19:49:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1347479345.33.0.225998401136.issue15906@psf.upfronthosting.co.za>
In-reply-to
Content
Thanks for committing the change.  However--

+    def test_no_double_type_conversion_of_default(self):
+        def extend(str_to_convert):
+            return str_to_convert + '*'
+
+        parser = argparse.ArgumentParser()
+        parser.add_argument('--test', type=extend, default='*')
+        args = parser.parse_args([])
+        # The test argument will be two stars, one coming from the default
+        # value and one coming from the type conversion being called exactly
+        # once.
+        self.assertEqual(NS(test='**'), args)

This was actually my concern, that the type conversion would be applied twice, and the reason for my suggesting the test.  This expected value is not the one we want, because it shows that the argument is getting "double converted," though the test is supposed to assert that double conversion doesn't take place.
History
Date User Action Args
2012-09-12 19:49:05chris.jerdoneksetrecipients: + chris.jerdonek, barry, georg.brandl, bethard, benjamin.peterson, Arfrever, r.david.murray, arnau, python-dev
2012-09-12 19:49:05chris.jerdoneksetmessageid: <1347479345.33.0.225998401136.issue15906@psf.upfronthosting.co.za>
2012-09-12 19:49:04chris.jerdoneklinkissue15906 messages
2012-09-12 19:49:04chris.jerdonekcreate