[pre-commit.ci lite] apply automatic fixes
This commit is contained in:
parent
6ff24afee8
commit
c5d00407b3
2 changed files with 14 additions and 12 deletions
|
|
@ -32,7 +32,7 @@ from .scaffold import _endpoint_from_view_func
|
||||||
from .scaffold import find_package
|
from .scaffold import find_package
|
||||||
from .scaffold import Scaffold
|
from .scaffold import Scaffold
|
||||||
from .scaffold import setupmethod
|
from .scaffold import setupmethod
|
||||||
from functools import wraps
|
|
||||||
if t.TYPE_CHECKING: # pragma: no cover
|
if t.TYPE_CHECKING: # pragma: no cover
|
||||||
from werkzeug.wrappers import Response as BaseResponse
|
from werkzeug.wrappers import Response as BaseResponse
|
||||||
|
|
||||||
|
|
@ -665,18 +665,18 @@ class App(Scaffold):
|
||||||
self, name: str | None = None
|
self, name: str | None = None
|
||||||
) -> t.Callable[[T_template_filter], T_template_filter]:
|
) -> t.Callable[[T_template_filter], T_template_filter]:
|
||||||
"""A decorator that is used to register custom template filters.
|
"""A decorator that is used to register custom template filters.
|
||||||
You can use this with or without parentheses. Example::
|
You can use this with or without parentheses. Example::
|
||||||
|
|
||||||
@app.template_filter
|
@app.template_filter
|
||||||
def double(x):
|
def double(x):
|
||||||
return x * 2
|
return x * 2
|
||||||
|
|
||||||
@app.template_filter()
|
@app.template_filter()
|
||||||
def reverse(s):
|
def reverse(s):
|
||||||
return s[::-1]
|
return s[::-1]
|
||||||
|
|
||||||
:param name: the optional name of the filter, otherwise the
|
:param name: the optional name of the filter, otherwise the
|
||||||
function name will be used.
|
function name will be used.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if callable(name):
|
if callable(name):
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import pytest
|
from flask import Flask
|
||||||
from flask import Flask, render_template_string
|
from flask import render_template_string
|
||||||
|
|
||||||
|
|
||||||
def test_template_filter_without_parentheses():
|
def test_template_filter_without_parentheses():
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
@ -12,6 +13,7 @@ def test_template_filter_without_parentheses():
|
||||||
output = render_template_string("{{ 2 | double }}")
|
output = render_template_string("{{ 2 | double }}")
|
||||||
assert output == "4"
|
assert output == "4"
|
||||||
|
|
||||||
|
|
||||||
def test_template_filter_with_parentheses():
|
def test_template_filter_with_parentheses():
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue