1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Refs #24121 -- Added __repr__() to AdminForm, BlockContext, BlockTranslateNode, and IncludeNode.

This commit is contained in:
saeedblanchette
2021-06-08 17:00:00 +01:00
committed by Mariusz Felisiak
parent cb6c19749d
commit 66ed03e7c9
7 changed files with 80 additions and 1 deletions

View File

@@ -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: []>]})>",
)