diff options
Diffstat (limited to 'tests/template_tests/syntax_tests/i18n/test_blocktranslate.py')
| -rw-r--r-- | tests/template_tests/syntax_tests/i18n/test_blocktranslate.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/template_tests/syntax_tests/i18n/test_blocktranslate.py b/tests/template_tests/syntax_tests/i18n/test_blocktranslate.py index 5079824b30..114d4392c6 100644 --- a/tests/template_tests/syntax_tests/i18n/test_blocktranslate.py +++ b/tests/template_tests/syntax_tests/i18n/test_blocktranslate.py @@ -5,6 +5,8 @@ from functools import partial, wraps from asgiref.local import Local from django.template import Context, Template, TemplateSyntaxError +from django.template.base import Token, TokenType +from django.templatetags.i18n import BlockTranslateNode from django.test import SimpleTestCase, override_settings from django.utils import translation from django.utils.safestring import mark_safe @@ -584,3 +586,17 @@ class MiscTests(SimpleTestCase): class MiscBlockTranslationTests(MiscTests): tag_name = 'blocktrans' + + +class BlockTranslateNodeTests(SimpleTestCase): + def test_repr(self): + block_translate_node = BlockTranslateNode(extra_context={}, singular=[ + Token(TokenType.TEXT, 'content'), + Token(TokenType.VAR, 'variable'), + ]) + self.assertEqual( + repr(block_translate_node), + '<BlockTranslateNode: extra_context={} ' + 'singular=[<Text token: "content...">, <Var token: "variable...">] ' + 'plural=None>', + ) |
