mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Added tests for AssertionErrors in get_complete_version() and _lazy_re_compile().
This commit is contained in:
committed by
Mariusz Felisiak
parent
7bdd09d016
commit
2cd0ccef04
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user