summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2014-08-22 14:46:07 (GMT)
committerBrett Cannon <brett@python.org>2014-08-22 14:46:07 (GMT)
commit145759c89204a8f327bccb2968ab180a8408281e (patch)
tree4d08780db44fc160048144a51649d77206898c61 /Lib
parent7c08b19f863649e540d4a290d58d6af0fe5d429c (diff)
parent14ad5319d94901f6a74169f448badcf67f37c6ab (diff)
downloadcpython-145759c89204a8f327bccb2968ab180a8408281e.zip
cpython-145759c89204a8f327bccb2968ab180a8408281e.tar.gz
cpython-145759c89204a8f327bccb2968ab180a8408281e.tar.bz2
Merge for issue #22191 fix
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_warnings.py19
-rw-r--r--Lib/warnings.py3
2 files changed, 21 insertions, 1 deletions
diff --git a/Lib/test/test_warnings.py b/Lib/test/test_warnings.py
index cd3288b..ad1d540 100644
--- a/Lib/test/test_warnings.py
+++ b/Lib/test/test_warnings.py
@@ -61,6 +61,25 @@ class BaseTest:
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(BaseTest):
diff --git a/Lib/warnings.py b/Lib/warnings.py
index f37b8a7..e53efa5 100644
--- a/Lib/warnings.py
+++ b/Lib/warnings.py
@@ -2,7 +2,8 @@
import sys
-__all__ = ["warn", "showwarning", "formatwarning", "filterwarnings",
+__all__ = ["warn", "warn_explicit", "showwarning",
+ "formatwarning", "filterwarnings", "simplefilter",
"resetwarnings", "catch_warnings"]