summaryrefslogtreecommitdiff
path: root/tests/template_tests/test_base.py
diff options
context:
space:
mode:
authorRyan O’Hara <rohara@copperleaf.com>2017-01-26 12:10:15 -0800
committerTim Graham <timograham@gmail.com>2017-02-06 17:53:21 -0500
commit7c4289d0b974c9b33bdc569308d8c99d7cac45d4 (patch)
tree48ecd2b92f174a32d6162371151b6b969bb86c75 /tests/template_tests/test_base.py
parent2757209c9de3764364a8e8af39cefa2445312546 (diff)
Fixed #27783 -- Switched VariableDoesNotExist.__str__() to repr() context.
Using __str__() and then repr'ing the result looks strange and can lead to recursive rendering of forms.
Diffstat (limited to 'tests/template_tests/test_base.py')
-rw-r--r--tests/template_tests/test_base.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/template_tests/test_base.py b/tests/template_tests/test_base.py
new file mode 100644
index 0000000000..5320af5e9a
--- /dev/null
+++ b/tests/template_tests/test_base.py
@@ -0,0 +1,8 @@
+from django.template.base import VariableDoesNotExist
+from django.test import SimpleTestCase
+
+
+class VariableDoesNotExistTests(SimpleTestCase):
+ def test_str(self):
+ exc = VariableDoesNotExist(msg='Failed lookup in %r', params=({'foo': 'bar'},))
+ self.assertEqual(str(exc), "Failed lookup in {'foo': 'bar'}")