diff options
author | Nikita Sobolev <mail@sobolevn.me> | 2023-06-14 10:26:20 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-14 10:26:20 (GMT) |
commit | 67f69dba0a2adc68c631bad5d970bdd22fc05d91 (patch) | |
tree | 7d4a62db48b6e699597f01119286e0d1a740e747 /Lib/test/test_re.py | |
parent | fb655e0c4581ca4bed80db0a083884b29fe142d2 (diff) | |
download | cpython-67f69dba0a2adc68c631bad5d970bdd22fc05d91.zip cpython-67f69dba0a2adc68c631bad5d970bdd22fc05d91.tar.gz cpython-67f69dba0a2adc68c631bad5d970bdd22fc05d91.tar.bz2 |
gh-105687: Remove deprecated objects from `re` module (#105688)
Diffstat (limited to 'Lib/test/test_re.py')
-rw-r--r-- | Lib/test/test_re.py | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py index d1575dc..e4d1435 100644 --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -2398,30 +2398,6 @@ class ReTests(unittest.TestCase): self.assertTrue(re.fullmatch(r'(?s:(?>.*?\.).*)\Z', "a.txt")) # reproducer self.assertTrue(re.fullmatch(r'(?s:(?=(?P<g0>.*?\.))(?P=g0).*)\Z', "a.txt")) - def test_template_function_and_flag_is_deprecated(self): - with self.assertWarns(DeprecationWarning) as cm: - template_re1 = re.template(r'a') - self.assertIn('re.template()', str(cm.warning)) - self.assertIn('is deprecated', str(cm.warning)) - self.assertIn('function', str(cm.warning)) - self.assertNotIn('flag', str(cm.warning)) - - with self.assertWarns(DeprecationWarning) as cm: - # we deliberately use more flags here to test that that still - # triggers the warning - # if paranoid, we could test multiple different combinations, - # but it's probably not worth it - template_re2 = re.compile(r'a', flags=re.TEMPLATE|re.UNICODE) - self.assertIn('re.TEMPLATE', str(cm.warning)) - self.assertIn('is deprecated', str(cm.warning)) - self.assertIn('flag', str(cm.warning)) - self.assertNotIn('function', str(cm.warning)) - - # while deprecated, is should still function - self.assertEqual(template_re1, template_re2) - self.assertTrue(template_re1.match('ahoy')) - self.assertFalse(template_re1.match('nope')) - @unittest.skipIf(multiprocessing is None, 'test requires multiprocessing') def test_regression_gh94675(self): pattern = re.compile(r'(?<=[({}])(((//[^\n]*)?[\n])([\000-\040])*)*' @@ -2615,11 +2591,11 @@ class PatternReprTests(unittest.TestCase): "re.IGNORECASE|re.DOTALL|re.VERBOSE|0x100000") self.assertEqual( repr(~re.I), - "re.ASCII|re.LOCALE|re.UNICODE|re.MULTILINE|re.DOTALL|re.VERBOSE|re.TEMPLATE|re.DEBUG") + "re.ASCII|re.LOCALE|re.UNICODE|re.MULTILINE|re.DOTALL|re.VERBOSE|re.DEBUG|0x1") self.assertEqual(repr(~(re.I|re.S|re.X)), - "re.ASCII|re.LOCALE|re.UNICODE|re.MULTILINE|re.TEMPLATE|re.DEBUG") + "re.ASCII|re.LOCALE|re.UNICODE|re.MULTILINE|re.DEBUG|0x1") self.assertEqual(repr(~(re.I|re.S|re.X|(1<<20))), - "re.ASCII|re.LOCALE|re.UNICODE|re.MULTILINE|re.TEMPLATE|re.DEBUG|0xffe00") + "re.ASCII|re.LOCALE|re.UNICODE|re.MULTILINE|re.DEBUG|0xffe01") class ImplementationTest(unittest.TestCase): |