[Python-checkins] cpython (3.4): Issue #22247: Add NNTPError to nntplib.__all__.

berker.peksag python-checkins at python.org
Sat Sep 20 07:53:41 CEST 2014


https://hg.python.org/cpython/rev/eb9eac80c17a
changeset:   92488:eb9eac80c17a
branch:      3.4
parent:      92486:569a889e3b6c
user:        Berker Peksag <berker.peksag at gmail.com>
date:        Sat Sep 20 08:53:05 2014 +0300
summary:
  Issue #22247: Add NNTPError to nntplib.__all__.

files:
  Lib/nntplib.py           |   4 ++--
  Lib/test/test_nntplib.py |  17 ++++++++++++-----
  Misc/NEWS                |   2 ++
  3 files changed, 16 insertions(+), 7 deletions(-)


diff --git a/Lib/nntplib.py b/Lib/nntplib.py
--- a/Lib/nntplib.py
+++ b/Lib/nntplib.py
@@ -80,8 +80,8 @@
 from socket import _GLOBAL_DEFAULT_TIMEOUT
 
 __all__ = ["NNTP",
-           "NNTPReplyError", "NNTPTemporaryError", "NNTPPermanentError",
-           "NNTPProtocolError", "NNTPDataError",
+           "NNTPError", "NNTPReplyError", "NNTPTemporaryError",
+           "NNTPPermanentError", "NNTPProtocolError", "NNTPDataError",
            "decode_header",
            ]
 
diff --git a/Lib/test/test_nntplib.py b/Lib/test/test_nntplib.py
--- a/Lib/test/test_nntplib.py
+++ b/Lib/test/test_nntplib.py
@@ -1412,11 +1412,18 @@
     def test_ssl_support(self):
         self.assertTrue(hasattr(nntplib, 'NNTP_SSL'))
 
-def test_main():
-    tests = [MiscTests, NNTPv1Tests, NNTPv2Tests, CapsAfterLoginNNTPv2Tests,
-            SendReaderNNTPv2Tests, NetworkedNNTPTests, NetworkedNNTP_SSLTests]
-    support.run_unittest(*tests)
 
+class PublicAPITests(unittest.TestCase):
+    """Ensures that the correct values are exposed in the public API."""
+
+    def test_module_all_attribute(self):
+        self.assertTrue(hasattr(nntplib, '__all__'))
+        target_api = ['NNTP', 'NNTPError', 'NNTPReplyError',
+                      'NNTPTemporaryError', 'NNTPPermanentError',
+                      'NNTPProtocolError', 'NNTPDataError', 'decode_header']
+        if ssl is not None:
+            target_api.append('NNTP_SSL')
+        self.assertEqual(set(nntplib.__all__), set(target_api))
 
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -32,6 +32,8 @@
 Library
 -------
 
+- Issue #22247: Add NNTPError to nntplib.__all__.
+
 - Issue #4180: The warnings registries are now reset when the filters
   are modified.
 

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list