mirror of
https://github.com/django/django.git
synced 2025-11-25 21:22:14 +00:00
Added tests for AssertionErrors in get_complete_version() and _lazy_re_compile().
This commit is contained in:
parent
7bdd09d016
commit
2cd0ccef04
2 changed files with 23 additions and 1 deletions
|
|
@ -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')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue