summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_warnings
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2022-04-05 19:05:48 (GMT)
committerGitHub <noreply@github.com>2022-04-05 19:05:48 (GMT)
commitc1d93b6411f975d67e43942f1a2745a22983c18c (patch)
treecccdd369da191fa03268967013d60369ab48fcdf /Lib/test/test_warnings
parent944f09adfcc59f54432ac2947cf95f3465d90e1e (diff)
downloadcpython-c1d93b6411f975d67e43942f1a2745a22983c18c.zip
cpython-c1d93b6411f975d67e43942f1a2745a22983c18c.tar.gz
cpython-c1d93b6411f975d67e43942f1a2745a22983c18c.tar.bz2
bpo-47061: deprecate the `aifc` module (GH-32134)
Co-authored-by: Christian Heimes <christian@python.org>
Diffstat (limited to 'Lib/test/test_warnings')
-rw-r--r--Lib/test/test_warnings/__init__.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/Lib/test/test_warnings/__init__.py b/Lib/test/test_warnings/__init__.py
index 4b1b4e1..f7f9311 100644
--- a/Lib/test/test_warnings/__init__.py
+++ b/Lib/test/test_warnings/__init__.py
@@ -1219,7 +1219,47 @@ class PyEnvironmentVariableTests(EnvironmentVariableTests, unittest.TestCase):
module = py_warnings
+class _DeprecatedTest(BaseTest, unittest.TestCase):
+
+ """Test _deprecated()."""
+
+ module = original_warnings
+
+ def test_warning(self):
+ version = (3, 11, 0, "final", 0)
+ test = [(4, 12), (4, 11), (4, 0), (3, 12)]
+ for remove in test:
+ msg = rf".*test_warnings.*{remove[0]}\.{remove[1]}"
+ filter = msg, DeprecationWarning
+ with self.subTest(remove=remove):
+ with warnings_helper.check_warnings(filter, quiet=False):
+ self.module._deprecated("test_warnings", remove=remove,
+ _version=version)
+
+ version = (3, 11, 0, "alpha", 0)
+ msg = r".*test_warnings.*3\.11"
+ with warnings_helper.check_warnings((msg, DeprecationWarning), quiet=False):
+ self.module._deprecated("test_warnings", remove=(3, 11),
+ _version=version)
+
+ def test_RuntimeError(self):
+ version = (3, 11, 0, "final", 0)
+ test = [(2, 0), (2, 12), (3, 10)]
+ for remove in test:
+ with self.subTest(remove=remove):
+ with self.assertRaises(RuntimeError):
+ self.module._deprecated("test_warnings", remove=remove,
+ _version=version)
+ for level in ["beta", "candidate", "final"]:
+ version = (3, 11, 0, level, 0)
+ with self.subTest(releaselevel=level):
+ with self.assertRaises(RuntimeError):
+ self.module._deprecated("test_warnings", remove=(3, 11),
+ _version=version)
+
+
class BootstrapTest(unittest.TestCase):
+
def test_issue_8766(self):
# "import encodings" emits a warning whereas the warnings is not loaded
# or not completely loaded (warnings imports indirectly encodings by