summaryrefslogtreecommitdiff
path: root/tests/test_ext.py
diff options
context:
space:
mode:
authorDavid Lord <davidism@gmail.com>2021-04-10 08:58:16 -0700
committerDavid Lord <davidism@gmail.com>2021-04-10 10:14:42 -0700
commit788d8bc1728490196f75ba4f8b7b1794a1974f0a (patch)
tree9441ab5c76b2fc97a90b6b7d563c267b830ba5c6 /tests/test_ext.py
parentc8db6c6313e90a47da92722f60010a6ada2e8644 (diff)
downloadjinja2-788d8bc1728490196f75ba4f8b7b1794a1974f0a.tar.gz
unify/rename filter and function decorators
Use pass_context instead of contextfilter and contextfunction, etc.
Diffstat (limited to 'tests/test_ext.py')
-rw-r--r--tests/test_ext.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/test_ext.py b/tests/test_ext.py
index 9790f95..20b19d8 100644
--- a/tests/test_ext.py
+++ b/tests/test_ext.py
@@ -3,10 +3,10 @@ from io import BytesIO
import pytest
-from jinja2 import contextfunction
from jinja2 import DictLoader
from jinja2 import Environment
from jinja2 import nodes
+from jinja2 import pass_context
from jinja2.exceptions import TemplateAssertionError
from jinja2.ext import Extension
from jinja2.lexer import count_newlines
@@ -74,14 +74,14 @@ def _get_with_context(value, ctx=None):
return value
-@contextfunction
+@pass_context
def gettext(context, string):
language = context.get("LANGUAGE", "en")
value = languages.get(language, {}).get(string, string)
return _get_with_context(value)
-@contextfunction
+@pass_context
def ngettext(context, s, p, n):
language = context.get("LANGUAGE", "en")
@@ -93,14 +93,14 @@ def ngettext(context, s, p, n):
return _get_with_context(value)
-@contextfunction
+@pass_context
def pgettext(context, c, s):
language = context.get("LANGUAGE", "en")
value = languages.get(language, {}).get(s, s)
return _get_with_context(value, c)
-@contextfunction
+@pass_context
def npgettext(context, c, s, p, n):
language = context.get("LANGUAGE", "en")