mirror of
https://github.com/django/django.git
synced 2025-07-24 13:44:32 +00:00
Fixed #27648 -- Deprecated (iLmsu) regex groups in url() patterns.
This commit is contained in:
parent
544b2ef29f
commit
51cde873d9
7 changed files with 60 additions and 9 deletions
|
@ -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)"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue