summaryrefslogtreecommitdiff
path: root/tests/template_tests/test_parser.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/template_tests/test_parser.py')
-rw-r--r--tests/template_tests/test_parser.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/template_tests/test_parser.py b/tests/template_tests/test_parser.py
index 317fb88238..9d68955b54 100644
--- a/tests/template_tests/test_parser.py
+++ b/tests/template_tests/test_parser.py
@@ -3,6 +3,8 @@ Testing some internals of the template processing.
These are *not* examples to be copied in user code.
"""
+import unittest
+
from django.template import Library, TemplateSyntaxError
from django.template.base import (
FilterExpression,
@@ -15,6 +17,7 @@ from django.template.base import (
)
from django.template.defaultfilters import register as filter_library
from django.test import SimpleTestCase
+from django.utils.version import PY314
class ParserTests(SimpleTestCase):
@@ -240,3 +243,17 @@ class ParserTests(SimpleTestCase):
FilterExpression(num, p).resolve({})
with self.assertRaises(TemplateSyntaxError):
FilterExpression(f"0|default:{num}", p).resolve({})
+
+ @unittest.skipUnless(PY314, "Deferred annotations are Python 3.14+ only")
+ def test_filter_deferred_annotation(self):
+ register = Library()
+
+ @register.filter("example")
+ def example_filter(value: str, arg: SomeType): # NOQA: F821
+ return f"{value}_{arg}"
+
+ result = FilterExpression.args_check(
+ "example", example_filter, ["extra_example"]
+ )
+
+ self.assertIs(result, True)