mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #27648 -- Deprecated (iLmsu) regex groups in url() patterns.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import unittest
|
||||
import warnings
|
||||
|
||||
from django.utils import regex_helper
|
||||
|
||||
@@ -27,8 +28,12 @@ class NormalizeTests(unittest.TestCase):
|
||||
def test_group_ignored(self):
|
||||
pattern = r"(?i)(?L)(?m)(?s)(?u)(?#)"
|
||||
expected = [('', [])]
|
||||
result = regex_helper.normalize(pattern)
|
||||
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)"
|
||||
|
||||
Reference in New Issue
Block a user