Skip to content

Commit 19e69c5

Browse files
committed
Issue #23883: Add missing APIs to __all__; patch by Jacek Kołodziej
1 parent d226d30 commit 19e69c5

15 files changed

Lines changed: 111 additions & 16 deletions

Lib/csv.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313

1414
from io import StringIO
1515

16-
__all__ = [ "QUOTE_MINIMAL", "QUOTE_ALL", "QUOTE_NONNUMERIC", "QUOTE_NONE",
17-
"Error", "Dialect", "__doc__", "excel", "excel_tab",
18-
"field_size_limit", "reader", "writer",
19-
"register_dialect", "get_dialect", "list_dialects", "Sniffer",
20-
"unregister_dialect", "__version__", "DictReader", "DictWriter" ]
16+
__all__ = ["QUOTE_MINIMAL", "QUOTE_ALL", "QUOTE_NONNUMERIC", "QUOTE_NONE",
17+
"Error", "Dialect", "__doc__", "excel", "excel_tab",
18+
"field_size_limit", "reader", "writer",
19+
"register_dialect", "get_dialect", "list_dialects", "Sniffer",
20+
"unregister_dialect", "__version__", "DictReader", "DictWriter",
21+
"unix_dialect"]
2122

2223
class Dialect:
2324
"""Describe a CSV dialect.

Lib/enum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from collections import OrderedDict
99

1010

11-
__all__ = ['Enum', 'IntEnum', 'unique']
11+
__all__ = ['EnumMeta', 'Enum', 'IntEnum', 'unique']
1212

1313

1414
def _is_descriptor(obj):

Lib/ftplib.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@
4242
import warnings
4343
from socket import _GLOBAL_DEFAULT_TIMEOUT
4444

45-
__all__ = ["FTP"]
45+
__all__ = ["FTP", "error_reply", "error_temp", "error_perm", "error_proto",
46+
"all_errors"]
4647

4748
# Magic number from <socket.h>
4849
MSG_OOB = 0x1 # Process data out of band

Lib/logging/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@
3333
'StreamHandler', 'WARN', 'WARNING', 'addLevelName', 'basicConfig',
3434
'captureWarnings', 'critical', 'debug', 'disable', 'error',
3535
'exception', 'fatal', 'getLevelName', 'getLogger', 'getLoggerClass',
36-
'info', 'log', 'makeLogRecord', 'setLoggerClass', 'warn', 'warning',
37-
'getLogRecordFactory', 'setLogRecordFactory', 'lastResort']
36+
'info', 'log', 'makeLogRecord', 'setLoggerClass', 'shutdown',
37+
'warn', 'warning', 'getLogRecordFactory', 'setLogRecordFactory',
38+
'lastResort', 'raiseExceptions']
3839

3940
try:
4041
import threading

Lib/optparse.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
'OptionError',
3939
'OptionConflictError',
4040
'OptionValueError',
41-
'BadOptionError']
41+
'BadOptionError',
42+
'check_choice']
4243

4344
__copyright__ = """
4445
Copyright (c) 2001-2006 Gregory P. Ward. All rights reserved.

Lib/test/test_csv.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,5 +1084,11 @@ def test_unicode_write(self):
10841084
self.assertEqual(fileobj.read(), expected)
10851085

10861086

1087+
class MiscTestCase(unittest.TestCase):
1088+
def test__all__(self):
1089+
extra = {'__doc__', '__version__'}
1090+
support.check__all__(self, csv, ('csv', '_csv'), extra=extra)
1091+
1092+
10871093
if __name__ == '__main__':
10881094
unittest.main()

Lib/test/test_enum.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from enum import Enum, IntEnum, EnumMeta, unique
77
from io import StringIO
88
from pickle import dumps, loads, PicklingError, HIGHEST_PROTOCOL
9+
from test import support
910

1011
# for pickle tests
1112
try:
@@ -1708,5 +1709,11 @@ def test_inspect_classify_class_attrs(self):
17081709
if failed:
17091710
self.fail("result does not equal expected, see print above")
17101711

1712+
1713+
class MiscTestCase(unittest.TestCase):
1714+
def test__all__(self):
1715+
support.check__all__(self, enum)
1716+
1717+
17111718
if __name__ == '__main__':
17121719
unittest.main()

Lib/test/test_ftplib.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1049,10 +1049,19 @@ def testTimeoutDirectAccess(self):
10491049
ftp.close()
10501050

10511051

1052+
class MiscTestCase(TestCase):
1053+
def test__all__(self):
1054+
blacklist = {'MSG_OOB', 'FTP_PORT', 'MAXLINE', 'CRLF', 'B_CRLF',
1055+
'Error', 'parse150', 'parse227', 'parse229', 'parse257',
1056+
'print_line', 'ftpcp', 'test'}
1057+
support.check__all__(self, ftplib, blacklist=blacklist)
1058+
1059+
10521060
def test_main():
10531061
tests = [TestFTPClass, TestTimeouts,
10541062
TestIPv6Environment,
1055-
TestTLS_FTPClassMixin, TestTLS_FTPClass]
1063+
TestTLS_FTPClassMixin, TestTLS_FTPClass,
1064+
MiscTestCase]
10561065

10571066
thread_info = support.threading_setup()
10581067
try:

Lib/test/test_logging.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4159,6 +4159,17 @@ def test_basic(self):
41594159
msg = 'Record not found in event log, went back %d records' % GO_BACK
41604160
self.assertTrue(found, msg=msg)
41614161

4162+
4163+
class MiscTestCase(unittest.TestCase):
4164+
def test__all__(self):
4165+
blacklist = {'logThreads', 'logMultiprocessing',
4166+
'logProcesses', 'currentframe',
4167+
'PercentStyle', 'StrFormatStyle', 'StringTemplateStyle',
4168+
'Filterer', 'PlaceHolder', 'Manager', 'RootLogger',
4169+
'root'}
4170+
support.check__all__(self, logging, blacklist=blacklist)
4171+
4172+
41624173
# Set the locale to the platform-dependent default. I have no idea
41634174
# why the test does this, but in any case we save the current locale
41644175
# first and restore it at the end.
@@ -4175,7 +4186,8 @@ def test_main():
41754186
RotatingFileHandlerTest, LastResortTest, LogRecordTest,
41764187
ExceptionTest, SysLogHandlerTest, HTTPHandlerTest,
41774188
NTEventLogHandlerTest, TimedRotatingFileHandlerTest,
4178-
UnixSocketHandlerTest, UnixDatagramHandlerTest, UnixSysLogHandlerTest)
4189+
UnixSocketHandlerTest, UnixDatagramHandlerTest, UnixSysLogHandlerTest,
4190+
MiscTestCase)
41794191

41804192
if __name__ == "__main__":
41814193
test_main()

Lib/test/test_optparse.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from test import support
1717

1818

19+
import optparse
1920
from optparse import make_option, Option, \
2021
TitledHelpFormatter, OptionParser, OptionGroup, \
2122
SUPPRESS_USAGE, OptionError, OptionConflictError, \
@@ -1650,6 +1651,12 @@ def test_numeric_options(self):
16501651
"option -l: invalid integer value: '0x12x'")
16511652

16521653

1654+
class MiscTestCase(unittest.TestCase):
1655+
def test__all__(self):
1656+
blacklist = {'check_builtin', 'AmbiguousOptionError', 'NO_DEFAULT'}
1657+
support.check__all__(self, optparse, blacklist=blacklist)
1658+
1659+
16531660
def test_main():
16541661
support.run_unittest(__name__)
16551662

0 commit comments

Comments
 (0)