summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2014-08-22 14:44:47 (GMT)
committerBrett Cannon <brett@python.org>2014-08-22 14:44:47 (GMT)
commit14ad5319d94901f6a74169f448badcf67f37c6ab (patch)
tree9e32321fec176b0593eb1755f94891563a601d74 /Lib/test
parenta969ae2e112dd40ad3e31714ec11bf17864a0309 (diff)
downloadcpython-14ad5319d94901f6a74169f448badcf67f37c6ab.zip
cpython-14ad5319d94901f6a74169f448badcf67f37c6ab.tar.gz
cpython-14ad5319d94901f6a74169f448badcf67f37c6ab.tar.bz2
Issue #22191: Fix warnings.__all__.
Thanks to Jon Poler for the patch.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_warnings.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/Lib/test/test_warnings.py b/Lib/test/test_warnings.py
index eec2c24..43b3b9c 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):