Kaydet (Commit) 14ad5319 authored tarafından Brett Cannon's avatar Brett Cannon

Issue #22191: Fix warnings.__all__.

Thanks to Jon Poler for the patch.
üst a969ae2e
...@@ -61,6 +61,25 @@ class BaseTest: ...@@ -61,6 +61,25 @@ class BaseTest:
sys.modules['warnings'] = original_warnings sys.modules['warnings'] = original_warnings
super(BaseTest, self).tearDown() 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): class FilterTests(BaseTest):
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
import sys import sys
__all__ = ["warn", "showwarning", "formatwarning", "filterwarnings", __all__ = ["warn", "warn_explicit", "showwarning",
"formatwarning", "filterwarnings", "simplefilter",
"resetwarnings", "catch_warnings"] "resetwarnings", "catch_warnings"]
......
...@@ -1054,6 +1054,7 @@ Antoine Pitrou ...@@ -1054,6 +1054,7 @@ Antoine Pitrou
Jean-François Piéronne Jean-François Piéronne
Oleg Plakhotnyuk Oleg Plakhotnyuk
Remi Pointel Remi Pointel
Jon Poler
Ariel Poliak Ariel Poliak
Guilherme Polo Guilherme Polo
Illia Polosukhin Illia Polosukhin
......
...@@ -27,6 +27,8 @@ Core and Builtins ...@@ -27,6 +27,8 @@ Core and Builtins
Library Library
------- -------
-- Issue #22191: Fix warnings.__all__.
- Issue #15696: Add a __sizeof__ implementation for mmap objects on Windows. - Issue #15696: Add a __sizeof__ implementation for mmap objects on Windows.
- Issue #22068: Avoided reference loops with Variables and Fonts in Tkinter. - Issue #22068: Avoided reference loops with Variables and Fonts in Tkinter.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment