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

Skip to content

Commit bdfeb03

Browse files
committed
Issue #22247: Add NNTPError to nntplib.__all__.
2 parents 257c6cb + 96756b6 commit bdfeb03

3 files changed

Lines changed: 16 additions & 7 deletions

File tree

Lib/nntplib.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@
8080
from socket import _GLOBAL_DEFAULT_TIMEOUT
8181

8282
__all__ = ["NNTP",
83-
"NNTPReplyError", "NNTPTemporaryError", "NNTPPermanentError",
84-
"NNTPProtocolError", "NNTPDataError",
83+
"NNTPError", "NNTPReplyError", "NNTPTemporaryError",
84+
"NNTPPermanentError", "NNTPProtocolError", "NNTPDataError",
8585
"decode_header",
8686
]
8787

Lib/test/test_nntplib.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,11 +1412,18 @@ def gives(y, M, d, date_str, time_str):
14121412
def test_ssl_support(self):
14131413
self.assertTrue(hasattr(nntplib, 'NNTP_SSL'))
14141414

1415-
def test_main():
1416-
tests = [MiscTests, NNTPv1Tests, NNTPv2Tests, CapsAfterLoginNNTPv2Tests,
1417-
SendReaderNNTPv2Tests, NetworkedNNTPTests, NetworkedNNTP_SSLTests]
1418-
support.run_unittest(*tests)
14191415

1416+
class PublicAPITests(unittest.TestCase):
1417+
"""Ensures that the correct values are exposed in the public API."""
1418+
1419+
def test_module_all_attribute(self):
1420+
self.assertTrue(hasattr(nntplib, '__all__'))
1421+
target_api = ['NNTP', 'NNTPError', 'NNTPReplyError',
1422+
'NNTPTemporaryError', 'NNTPPermanentError',
1423+
'NNTPProtocolError', 'NNTPDataError', 'decode_header']
1424+
if ssl is not None:
1425+
target_api.append('NNTP_SSL')
1426+
self.assertEqual(set(nntplib.__all__), set(target_api))
14201427

14211428
if __name__ == "__main__":
1422-
test_main()
1429+
unittest.main()

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ Core and Builtins
137137
Library
138138
-------
139139

140+
- Issue #22247: Add NNTPError to nntplib.__all__.
141+
140142
- Issue #22366: urllib.request.urlopen will accept a context object
141143
(SSLContext) as an argument which will then used be for HTTPS connection.
142144
Patch by Alex Gaynor.

0 commit comments

Comments
 (0)