[Python-checkins] r86086 - in python/branches/py3k/Lib: argparse.py test/test_argparse.py

steven.bethard python-checkins at python.org
Mon Nov 1 16:23:12 CET 2010


Author: steven.bethard
Date: Mon Nov  1 16:23:12 2010
New Revision: 86086

Log:
Get argparse.__all__ back up to date (issue 9353)

Modified:
   python/branches/py3k/Lib/argparse.py
   python/branches/py3k/Lib/test/test_argparse.py

Modified: python/branches/py3k/Lib/argparse.py
==============================================================================
--- python/branches/py3k/Lib/argparse.py	(original)
+++ python/branches/py3k/Lib/argparse.py	Mon Nov  1 16:23:12 2010
@@ -65,13 +65,20 @@
 __all__ = [
     'ArgumentParser',
     'ArgumentError',
-    'Namespace',
-    'Action',
+    'ArgumentTypeError',
     'FileType',
     'HelpFormatter',
+    'ArgumentDefaultsHelpFormatter',
     'RawDescriptionHelpFormatter',
     'RawTextHelpFormatter',
-    'ArgumentDefaultsHelpFormatter',
+    'Namespace',
+    'Action',
+    'ONE_OR_MORE',
+    'OPTIONAL',
+    'PARSER',
+    'REMAINDER',
+    'SUPPRESS',
+    'ZERO_OR_MORE',
 ]
 
 

Modified: python/branches/py3k/Lib/test/test_argparse.py
==============================================================================
--- python/branches/py3k/Lib/test/test_argparse.py	(original)
+++ python/branches/py3k/Lib/test/test_argparse.py	Mon Nov  1 16:23:12 2010
@@ -1,6 +1,7 @@
 # Author: Steven J. Bethard <steven.bethard at gmail.com>.
 
 import codecs
+import inspect
 import os
 import shutil
 import sys
@@ -4245,6 +4246,15 @@
         for name in argparse.__all__:
             self.assertTrue(hasattr(argparse, name))
 
+    def test_all_exports_everything_but_modules(self):
+        items = [
+            name
+            for name, value in vars(argparse).items()
+            if not name.startswith("_")
+            if not inspect.ismodule(value)
+        ]
+        self.assertEqual(sorted(items), sorted(argparse.__all__))
+
 def test_main():
     # silence warnings about version argument - these are expected
     with support.check_warnings(


More information about the Python-checkins mailing list