diff --git a/Lib/argparse.py b/Lib/argparse.py index 654ac487614..d5bc16c6b14 100644 --- a/Lib/argparse.py +++ b/Lib/argparse.py @@ -65,13 +65,20 @@ __version__ = '1.1' __all__ = [ 'ArgumentParser', 'ArgumentError', - 'Namespace', - 'Action', + 'ArgumentTypeError', 'FileType', 'HelpFormatter', + 'ArgumentDefaultsHelpFormatter', 'RawDescriptionHelpFormatter', 'RawTextHelpFormatter', - 'ArgumentDefaultsHelpFormatter', + 'Namespace', + 'Action', + 'ONE_OR_MORE', + 'OPTIONAL', + 'PARSER', + 'REMAINDER', + 'SUPPRESS', + 'ZERO_OR_MORE', ] diff --git a/Lib/test/test_argparse.py b/Lib/test/test_argparse.py index 894ad58d263..349de7b8170 100644 --- a/Lib/test/test_argparse.py +++ b/Lib/test/test_argparse.py @@ -1,6 +1,7 @@ # Author: Steven J. Bethard . import codecs +import inspect import os import shutil import sys @@ -4256,6 +4257,15 @@ class TestImportStar(TestCase): 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 test_support.check_warnings(