MCPcopy Create free account
hub / github.com/encode/starlette / test_file_response_with_directory_raises_error

Function test_file_response_with_directory_raises_error

tests/test_responses.py:305–310  ·  view source on GitHub ↗
(tmp_path: Path, test_client_factory: TestClientFactory)

Source from the content-addressed store, hash-verified

303
304
305def test_file_response_with_directory_raises_error(tmp_path: Path, test_client_factory: TestClientFactory) -> None:
306 app = FileResponse(path=tmp_path, filename="example.png")
307 client = test_client_factory(app)
308 with pytest.raises(RuntimeError) as exc_info:
309 client.get("/")
310 assert "is not a file" in str(exc_info.value)
311
312
313def test_file_response_with_missing_file_raises_error(tmp_path: Path, test_client_factory: TestClientFactory) -> None:

Callers

nothing calls this directly

Calls 3

FileResponseClass · 0.90
test_client_factoryFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected