mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Refs #23919 -- Simplified assertRaisesRegex()'s that accounted for Python 2.
This commit is contained in:
parent
dc8834cad4
commit
109b33f64c
12 changed files with 43 additions and 42 deletions
|
@ -313,25 +313,21 @@ class TemplateTagLoadingTests(SimpleTestCase):
|
|||
msg = (
|
||||
"Invalid template library specified. ImportError raised when "
|
||||
"trying to load 'template_tests.broken_tag': cannot import name "
|
||||
"'?Xtemplate'?"
|
||||
"'Xtemplate'"
|
||||
)
|
||||
with self.assertRaisesRegex(InvalidTemplateLibrary, msg):
|
||||
Engine(libraries={
|
||||
'broken_tag': 'template_tests.broken_tag',
|
||||
})
|
||||
with self.assertRaisesMessage(InvalidTemplateLibrary, msg):
|
||||
Engine(libraries={'broken_tag': 'template_tests.broken_tag'})
|
||||
|
||||
def test_load_error_egg(self):
|
||||
egg_name = '%s/tagsegg.egg' % self.egg_dir
|
||||
msg = (
|
||||
"Invalid template library specified. ImportError raised when "
|
||||
"trying to load 'tagsegg.templatetags.broken_egg': cannot "
|
||||
"import name '?Xtemplate'?"
|
||||
"import name 'Xtemplate'"
|
||||
)
|
||||
with extend_sys_path(egg_name):
|
||||
with self.assertRaisesRegex(InvalidTemplateLibrary, msg):
|
||||
Engine(libraries={
|
||||
'broken_egg': 'tagsegg.templatetags.broken_egg',
|
||||
})
|
||||
with self.assertRaisesMessage(InvalidTemplateLibrary, msg):
|
||||
Engine(libraries={'broken_egg': 'tagsegg.templatetags.broken_egg'})
|
||||
|
||||
def test_load_working_egg(self):
|
||||
ttext = "{% load working_egg %}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue