Commit 01408453 authored by Brett Cannon's avatar Brett Cannon

Issue #22191: Fix warnings.__all__.

Thanks to Jon Poler for the patch.
parent 95cf9862
......@@ -73,7 +73,7 @@ class AllTest(unittest.TestCase):
# 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
......
......@@ -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):
......
......@@ -7,7 +7,8 @@ import linecache
import sys
import types
__all__ = ["warn", "showwarning", "formatwarning", "filterwarnings",
__all__ = ["warn", "warn_explicit", "showwarning",
"formatwarning", "filterwarnings", "simplefilter",
"resetwarnings", "catch_warnings"]
......
......@@ -1052,6 +1052,7 @@ Antoine Pitrou
Jean-François Piéronne
Oleg Plakhotnyuk
Remi Pointel
Jon Poler
Ariel Poliak
Guilherme Polo
Illia Polosukhin
......
......@@ -19,6 +19,8 @@ Core and Builtins
Library
-------
- Issue #22191: Fixed warnings.__all__.
- Issue #21308: Backport numerous features from Python's ssl module. This is
part of PEP 466.
......
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