summaryrefslogtreecommitdiff
path: root/tests/utils_tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/utils_tests')
-rw-r--r--tests/utils_tests/test_regex_helper.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/utils_tests/test_regex_helper.py b/tests/utils_tests/test_regex_helper.py
index 77bcd5bb35..895890bd26 100644
--- a/tests/utils_tests/test_regex_helper.py
+++ b/tests/utils_tests/test_regex_helper.py
@@ -1,5 +1,7 @@
+import re
import unittest
+from django.test import SimpleTestCase
from django.utils import regex_helper
@@ -41,3 +43,12 @@ class NormalizeTests(unittest.TestCase):
['first_group_name'])]
result = regex_helper.normalize(pattern)
self.assertEqual(result, expected)
+
+
+class LazyReCompileTests(SimpleTestCase):
+ def test_flags_with_pre_compiled_regex(self):
+ test_pattern = re.compile('test')
+ lazy_test_pattern = regex_helper._lazy_re_compile(test_pattern, re.I)
+ msg = 'flags must be empty if regex is passed pre-compiled'
+ with self.assertRaisesMessage(AssertionError, msg):
+ lazy_test_pattern.match('TEST')