mirror of
https://github.com/python/cpython.git
synced 2024-11-27 20:04:41 +08:00
Get argparse.__all__ back up to date (issue 9353)
This commit is contained in:
parent
c4ac887917
commit
72c553829a
@ -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',
|
||||
]
|
||||
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
# Author: Steven J. Bethard <steven.bethard@gmail.com>.
|
||||
|
||||
import codecs
|
||||
import inspect
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
@ -4245,6 +4246,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 support.check_warnings(
|
||||
|
Loading…
Reference in New Issue
Block a user