Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 72c5538

Browse files
committed
Get argparse.__all__ back up to date (issue 9353)
1 parent c4ac887 commit 72c5538

2 files changed

Lines changed: 20 additions & 3 deletions

File tree

Lib/argparse.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,20 @@
6565
__all__ = [
6666
'ArgumentParser',
6767
'ArgumentError',
68-
'Namespace',
69-
'Action',
68+
'ArgumentTypeError',
7069
'FileType',
7170
'HelpFormatter',
71+
'ArgumentDefaultsHelpFormatter',
7272
'RawDescriptionHelpFormatter',
7373
'RawTextHelpFormatter',
74-
'ArgumentDefaultsHelpFormatter',
74+
'Namespace',
75+
'Action',
76+
'ONE_OR_MORE',
77+
'OPTIONAL',
78+
'PARSER',
79+
'REMAINDER',
80+
'SUPPRESS',
81+
'ZERO_OR_MORE',
7582
]
7683

7784

Lib/test/test_argparse.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Author: Steven J. Bethard <[email protected]>.
22

33
import codecs
4+
import inspect
45
import os
56
import shutil
67
import sys
@@ -4245,6 +4246,15 @@ def test(self):
42454246
for name in argparse.__all__:
42464247
self.assertTrue(hasattr(argparse, name))
42474248

4249+
def test_all_exports_everything_but_modules(self):
4250+
items = [
4251+
name
4252+
for name, value in vars(argparse).items()
4253+
if not name.startswith("_")
4254+
if not inspect.ismodule(value)
4255+
]
4256+
self.assertEqual(sorted(items), sorted(argparse.__all__))
4257+
42484258
def test_main():
42494259
# silence warnings about version argument - these are expected
42504260
with support.check_warnings(

0 commit comments

Comments
 (0)