Issue #22191: Fix warnings.__all__.
Thanks to Jon Poler for the patch.
diff --git a/Lib/test/test___all__.py b/Lib/test/test___all__.py
index 2c5dbef..789f9fb 100644
--- a/Lib/test/test___all__.py
+++ b/Lib/test/test___all__.py
@@ -73,7 +73,7 @@
# than an AttributeError somewhere deep in CGIHTTPServer.
import _socket
- # rlcompleter needs special consideration; it import readline which
+ # rlcompleter needs special consideration; it imports readline which
# initializes GNU readline which calls setlocale(LC_CTYPE, "")... :-(
try:
import rlcompleter
diff --git a/Lib/test/test_warnings.py b/Lib/test/test_warnings.py
index a770ba2..fb2046e 100644
--- a/Lib/test/test_warnings.py
+++ b/Lib/test/test_warnings.py
@@ -62,6 +62,25 @@
sys.modules['warnings'] = original_warnings
super(BaseTest, self).tearDown()
+class PublicAPITests(BaseTest):
+
+ """Ensures that the correct values are exposed in the
+ public API.
+ """
+
+ def test_module_all_attribute(self):
+ self.assertTrue(hasattr(self.module, '__all__'))
+ target_api = ["warn", "warn_explicit", "showwarning",
+ "formatwarning", "filterwarnings", "simplefilter",
+ "resetwarnings", "catch_warnings"]
+ self.assertSetEqual(set(self.module.__all__),
+ set(target_api))
+
+class CPublicAPITests(PublicAPITests, unittest.TestCase):
+ module = c_warnings
+
+class PyPublicAPITests(PublicAPITests, unittest.TestCase):
+ module = py_warnings
class FilterTests(object):
diff --git a/Lib/warnings.py b/Lib/warnings.py
index 08b70af..bf9a5d8 100644
--- a/Lib/warnings.py
+++ b/Lib/warnings.py
@@ -7,7 +7,8 @@
import sys
import types
-__all__ = ["warn", "showwarning", "formatwarning", "filterwarnings",
+__all__ = ["warn", "warn_explicit", "showwarning",
+ "formatwarning", "filterwarnings", "simplefilter",
"resetwarnings", "catch_warnings"]