diff --git a/starlette/templating.py b/starlette/templating.py index b26ce83ae..abc845fed 100644 --- a/starlette/templating.py +++ b/starlette/templating.py @@ -206,7 +206,7 @@ def TemplateResponse( if "request" not in kwargs: warnings.warn( "The `TemplateResponse` now requires the `request` argument.\n" - 'Replace `TemplateResponse(name, {"context": context})` by `TemplateResponse(request, name)`.", # noqa: E501 + 'Replace `TemplateResponse(name, {"context": context})` by `TemplateResponse(request, name)`.', # noqa: E501 DeprecationWarning, ) if "request" not in kwargs.get("context", {}): diff --git a/tests/test_templates.py b/tests/test_templates.py index db0b2bb63..102f0bfcc 100644 --- a/tests/test_templates.py +++ b/tests/test_templates.py @@ -193,7 +193,7 @@ def test_templates_with_kwargs_only_requires_request_in_context(tmpdir): templates = Jinja2Templates(directory=str(tmpdir)) with pytest.warns( DeprecationWarning, - match="TemplateResponse requires `request` keyword argument.", + match="requires the `request` argument", ): with pytest.raises(ValueError): templates.TemplateResponse(name="index.html", context={"a": "b"}) @@ -220,7 +220,7 @@ def page(request): with pytest.warns( DeprecationWarning, - match="TemplateResponse requires `request` keyword argument.", + match="requires the `request` argument", ): client.get("/")