diff --git a/django/template/loader.py b/django/template/loader.py
a
|
b
|
|
179 | 179 | |
180 | 180 | def select_template(template_name_list): |
181 | 181 | "Given a list of template names, returns the first that can be loaded." |
| 182 | if template_name_list is not None and not template_name_list: |
| 183 | raise TemplateDoesNotExist("empty list of candidates") |
182 | 184 | not_found = [] |
183 | 185 | for template_name in template_name_list: |
184 | 186 | try: |
diff --git a/tests/regressiontests/templates/loaders.py b/tests/regressiontests/templates/loaders.py
a
|
b
|
|
143 | 143 | self.assertEqual(output, 'obj:after') |
144 | 144 | self.assertEqual(context['obj'], 'before') |
145 | 145 | |
| 146 | def test_empty_list(self): |
| 147 | self.assertRaisesRegexp(TemplateDoesNotExist, |
| 148 | 'empty list of candidates$', |
| 149 | loader.render_to_string, []) |
| 150 | |
| 151 | |
| 152 | def test_select_templates_from_empty_list(self): |
| 153 | self.assertRaisesRegexp(TemplateDoesNotExist, |
| 154 | 'empty list of candidates$', |
| 155 | loader.select_template, []) |
| 156 | |
146 | 157 | if __name__ == "__main__": |
147 | 158 | unittest.main() |