1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Refs #27648 -- Removed support for (iLmsu) regex groups in url() patterns.

Per deprecation timeline.
This commit is contained in:
Tim Graham
2017-09-02 21:16:09 -04:00
parent 5bcca2a056
commit ba42456c2e
4 changed files with 2 additions and 54 deletions

View File

@@ -1,5 +1,4 @@
import unittest
import warnings
from django.utils import regex_helper
@@ -23,16 +22,6 @@ class NormalizeTests(unittest.TestCase):
result = regex_helper.normalize(pattern)
self.assertEqual(result, expected)
def test_group_ignored(self):
pattern = r"(?i)(?L)(?m)(?s)(?u)(?#)"
expected = [('', [])]
with warnings.catch_warnings(record=True) as warns:
warnings.simplefilter('always')
result = regex_helper.normalize(pattern)
self.assertEqual(result, expected)
for i, char in enumerate('iLmsu#'):
self.assertEqual(str(warns[i].message), 'Using (?%s) in url() patterns is deprecated.' % char)
def test_group_noncapturing(self):
pattern = r"(?:non-capturing)"
expected = [('non-capturing', [])]