]> granicus.if.org Git - python/commitdiff
Issue #22247: Add NNTPError to nntplib.__all__.
authorBerker Peksag <berker.peksag@gmail.com>
Sat, 20 Sep 2014 05:53:05 +0000 (08:53 +0300)
committerBerker Peksag <berker.peksag@gmail.com>
Sat, 20 Sep 2014 05:53:05 +0000 (08:53 +0300)
Lib/nntplib.py
Lib/test/test_nntplib.py
Misc/NEWS

index 4ded78a9e879dfc427d1556301a65bbdbcb85325..d33faf85b9e5a7aa887b7437c273ab06f35630bb 100644 (file)
@@ -80,8 +80,8 @@ from email.header import decode_header as _email_decode_header
 from socket import _GLOBAL_DEFAULT_TIMEOUT
 
 __all__ = ["NNTP",
-           "NNTPReplyError", "NNTPTemporaryError", "NNTPPermanentError",
-           "NNTPProtocolError", "NNTPDataError",
+           "NNTPError", "NNTPReplyError", "NNTPTemporaryError",
+           "NNTPPermanentError", "NNTPProtocolError", "NNTPDataError",
            "decode_header",
            ]
 
index 71a4ec022b149e2a863b0925087309bde7863042..fb216c1f52c403084f015aba438174ef2ae44d92 100644 (file)
@@ -1412,11 +1412,18 @@ class MiscTests(unittest.TestCase):
     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()
index 9806e2734dc014f7b50359c2de10468d00b2488d..1ba6a4ac6525514ebe36c742bb26eeb7d3edbb58 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -32,6 +32,8 @@ Core and Builtins
 Library
 -------
 
+- Issue #22247: Add NNTPError to nntplib.__all__.
+
 - Issue #4180: The warnings registries are now reset when the filters
   are modified.