diff options
author | Brett Cannon <brett@python.org> | 2014-08-22 14:50:47 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2014-08-22 14:50:47 (GMT) |
commit | 01408453f12a1acd7c1b2caeca377d4bd6ea7947 (patch) | |
tree | f5e08fc3dac8f6cae585a156fa48b041162b209e /Lib/test/test_warnings.py | |
parent | 95cf98625b484f9f960859d70300e62d0c14d779 (diff) | |
download | cpython-01408453f12a1acd7c1b2caeca377d4bd6ea7947.zip cpython-01408453f12a1acd7c1b2caeca377d4bd6ea7947.tar.gz cpython-01408453f12a1acd7c1b2caeca377d4bd6ea7947.tar.bz2 |
Issue #22191: Fix warnings.__all__.
Thanks to Jon Poler for the patch.
Diffstat (limited to 'Lib/test/test_warnings.py')
-rw-r--r-- | Lib/test/test_warnings.py | 19 |
1 files changed, 19 insertions, 0 deletions
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 @@ class BaseTest(unittest.TestCase): 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): |