MCPcopy
hub / github.com/encode/starlette / test_templates_with_directory

Function test_templates_with_directory

tests/test_templates.py:148–155  ·  view source on GitHub ↗
(tmpdir: Path)

Source from the content-addressed store, hash-verified

146
147
148def test_templates_with_directory(tmpdir: Path) -> None:
149 path = os.path.join(tmpdir, "index.html")
150 with open(path, "w") as file:
151 file.write("Hello")
152
153 templates = Jinja2Templates(directory=str(tmpdir))
154 template = templates.get_template("index.html")
155 assert template.render({}) == "Hello"
156
157
158def test_templates_with_environment(tmpdir: Path, test_client_factory: TestClientFactory) -> None:

Callers

nothing calls this directly

Calls 4

get_templateMethod · 0.95
Jinja2TemplatesClass · 0.90
writeMethod · 0.45
renderMethod · 0.45

Tested by

no test coverage detected