diff options
| author | saeedblanchette <saiidblanchettel@outlook.com> | 2021-06-08 17:00:00 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-06-10 12:47:53 +0200 |
| commit | 66ed03e7c9ae4cd754aa918c6f4c9227cf424141 (patch) | |
| tree | c8df099f407702b7552d7421a8b2defdbbe01138 /tests/template_tests/syntax_tests/test_basic.py | |
| parent | cb6c19749d342c3dc0f97d89ff6887b220cf45b8 (diff) | |
Refs #24121 -- Added __repr__() to AdminForm, BlockContext, BlockTranslateNode, and IncludeNode.
Diffstat (limited to 'tests/template_tests/syntax_tests/test_basic.py')
| -rw-r--r-- | tests/template_tests/syntax_tests/test_basic.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/template_tests/syntax_tests/test_basic.py b/tests/template_tests/syntax_tests/test_basic.py index e4a2643ae7..011ce51229 100644 --- a/tests/template_tests/syntax_tests/test_basic.py +++ b/tests/template_tests/syntax_tests/test_basic.py @@ -1,5 +1,6 @@ from django.template.base import TemplateSyntaxError from django.template.context import Context +from django.template.loader_tags import BlockContext, BlockNode from django.test import SimpleTestCase from ..utils import SilentAttrClass, SilentGetItemClass, SomeClass, setup @@ -333,3 +334,14 @@ class BasicSyntaxTests(SimpleTestCase): self.assertEqual(output, '%%') output = self.engine.render_to_string('tpl-weird-percent') self.assertEqual(output, '% %s') + + +class BlockContextTests(SimpleTestCase): + def test_repr(self): + block_context = BlockContext() + block_context.add_blocks({'content': BlockNode('content', [])}) + self.assertEqual( + repr(block_context), + "<BlockContext: blocks=defaultdict(<class 'list'>, " + "{'content': [<Block Node: content. Contents: []>]})>", + ) |
