summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorcheng <chengyuan.china@gmail.com>2022-05-19 21:01:10 -0700
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-05-20 08:41:16 +0200
commit731bb6479e7ac5b50f00b8827955e86af27a2507 (patch)
treec6a472a9ed33ae265e2381b70344a4474518084c /tests
parent33552c7a135e03baf52f817214d2452fd8d22fef (diff)
[4.1.x] Fixed #33653 -- Fixed template crash when calling methods for built-in types without required arguments.
Regression in 09341856ed9008875c1cc883dc0c287670131458. Backport of 0dd29209091280ccf34e07c9468746c396b7778e from main
Diffstat (limited to 'tests')
-rw-r--r--tests/template_tests/tests.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/template_tests/tests.py b/tests/template_tests/tests.py
index b849b4a2e7..f35ae49ca3 100644
--- a/tests/template_tests/tests.py
+++ b/tests/template_tests/tests.py
@@ -183,6 +183,14 @@ class TemplateTestMixin:
for node in template.nodelist:
self.assertEqual(node.origin, template.origin)
+ def test_render_built_in_type_method(self):
+ """
+ Templates should not crash when rendering methods for built-in types
+ without required arguments.
+ """
+ template = self._engine().from_string("{{ description.count }}")
+ self.assertEqual(template.render(Context({"description": "test"})), "")
+
class TemplateTests(TemplateTestMixin, SimpleTestCase):
debug_engine = False