diff options
author | Ahmed Mohamed <mohamed@kuicr.kyoto-u.ac.jp> | 2016-01-21 17:40:33 +0900 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2016-01-25 18:37:02 -0500 |
commit | 229488c8a1486f25b1f2b5ca422cac67708c6c9d (patch) | |
tree | 355afdb8822454c9ccde1f3bdc4def448d193d1a /tests/template_loader | |
parent | 275d11fbc5e8f664552a458ce141d4394fa70e1f (diff) | |
download | django-229488c8a1486f25b1f2b5ca422cac67708c6c9d.tar.gz |
Fixed #26109 -- Raised a helpful error if loader.select_tamplate() is passed a string.
Diffstat (limited to 'tests/template_loader')
-rw-r--r-- | tests/template_loader/tests.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/template_loader/tests.py b/tests/template_loader/tests.py index ba712e521b..5e62574666 100644 --- a/tests/template_loader/tests.py +++ b/tests/template_loader/tests.py @@ -60,6 +60,15 @@ class TemplateLoaderTests(SimpleTestCase): with self.assertRaises(TemplateDoesNotExist): select_template([]) + def test_select_template_string(self): + with self.assertRaisesMessage( + TypeError, + "select_template() takes an iterable of template names but got a " + "string: 'template_loader/hello.html'. Use get_template() if you " + "want to load a single template by name." + ): + select_template('template_loader/hello.html') + def test_select_template_not_found(self): with self.assertRaises(TemplateDoesNotExist) as e: select_template(["template_loader/unknown.html", |