@@ -78,7 +78,7 @@ def Stub():
7878 async with DisplayFixture (backend = server ) as new_display :
7979 await new_display .show (Stub )
8080
81- # Wait for the log record to be popualted
81+ # Wait for the log record to be populated
8282 for _ in range (10 ):
8383 if len (server .log_records ) > 0 :
8484 break
@@ -117,3 +117,26 @@ async def app(scope, receive, send): ...
117117 request , "GET" , url , timeout = REACTPY_TESTS_DEFAULT_TIMEOUT .current
118118 )
119119 assert response .status_code == 404
120+
121+
122+ async def test_templatetag_bad_kwargs (page , caplog ):
123+ """Override for the display fixture that uses ReactPyMiddleware."""
124+ templates = Jinja2Templates (
125+ env = JinjaEnvironment (
126+ loader = JinjaFileSystemLoader ("tests/templates" ),
127+ extensions = ["reactpy.templatetags.Jinja" ],
128+ )
129+ )
130+
131+ async def homepage (request ):
132+ return templates .TemplateResponse (request , "jinja_bad_kwargs.html" )
133+
134+ app = Starlette (routes = [Route ("/" , homepage )])
135+
136+ async with BackendFixture (app ) as server :
137+ async with DisplayFixture (backend = server , driver = page ) as new_display :
138+ await new_display .goto ("/" )
139+
140+ # This test could be improved by actually checking if `bad kwargs` error message is shown in
141+ # `stderr`, but I was struggling to get that to work.
142+ assert "internal server error" in (await new_display .page .content ()).lower ()
0 commit comments