[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 Scaffold
|
||||
from .scaffold import setupmethod
|
||||
from functools import wraps
|
||||
|
||||
if t.TYPE_CHECKING: # pragma: no cover
|
||||
from werkzeug.wrappers import Response as BaseResponse
|
||||
|
||||
|
|
@ -665,18 +665,18 @@ class App(Scaffold):
|
|||
self, name: str | None = None
|
||||
) -> t.Callable[[T_template_filter], T_template_filter]:
|
||||
"""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
|
||||
def double(x):
|
||||
return x * 2
|
||||
@app.template_filter
|
||||
def double(x):
|
||||
return x * 2
|
||||
|
||||
@app.template_filter()
|
||||
def reverse(s):
|
||||
return s[::-1]
|
||||
@app.template_filter()
|
||||
def reverse(s):
|
||||
return s[::-1]
|
||||
|
||||
:param name: the optional name of the filter, otherwise the
|
||||
function name will be used.
|
||||
:param name: the optional name of the filter, otherwise the
|
||||
function name will be used.
|
||||
"""
|
||||
|
||||
if callable(name):
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import pytest
|
||||
from flask import Flask, render_template_string
|
||||
from flask import Flask
|
||||
from flask import render_template_string
|
||||
|
||||
|
||||
def test_template_filter_without_parentheses():
|
||||
app = Flask(__name__)
|
||||
|
|
@ -12,6 +13,7 @@ def test_template_filter_without_parentheses():
|
|||
output = render_template_string("{{ 2 | double }}")
|
||||
assert output == "4"
|
||||
|
||||
|
||||
def test_template_filter_with_parentheses():
|
||||
app = Flask(__name__)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue