diff options
| author | Thomas Orozco <thomas@orozco.fr> | 2015-09-17 21:16:14 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-09-18 08:10:38 -0400 |
| commit | d49667ef26c1fba0612151064d414854ae45a830 (patch) | |
| tree | bfd0a687d4be6cefd20f7accff4a19b99c3da058 /tests | |
| parent | b02f08e02c34bcf19444c15b54c5f64ddd4c9ef2 (diff) | |
Refs #25422 -- Added a test for a template tag with type annotations.
This doesn't work in Django 1.8 but was fixed in Django 1.9 as a
side effect of another change.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/template_tests/annotated_tag_function.py | 8 | ||||
| -rw-r--r-- | tests/template_tests/test_custom.py | 7 |
2 files changed, 15 insertions, 0 deletions
diff --git a/tests/template_tests/annotated_tag_function.py b/tests/template_tests/annotated_tag_function.py new file mode 100644 index 0000000000..bd3017c27c --- /dev/null +++ b/tests/template_tests/annotated_tag_function.py @@ -0,0 +1,8 @@ +from django import template + +register = template.Library() + + +@register.simple_tag() +def annotated_tag_function(val: int): + return val diff --git a/tests/template_tests/test_custom.py b/tests/template_tests/test_custom.py index 1b63953860..48252e1788 100644 --- a/tests/template_tests/test_custom.py +++ b/tests/template_tests/test_custom.py @@ -1,6 +1,7 @@ from __future__ import unicode_literals import os +from unittest import skipUnless from django.template import Context, Engine, TemplateSyntaxError from django.template.base import Node @@ -380,3 +381,9 @@ class TemplateTagLoadingTests(SimpleTestCase): 'working_egg': 'tagsegg.templatetags.working_egg', }) engine.from_string(ttext) + + @skipUnless(six.PY3, "Python 3 only -- Python 2 doesn't have annotations.") + def test_load_annotated_function(self): + Engine(libraries={ + 'annotated_tag_function': 'template_tests.annotated_tag_function', + }) |
