"""TestClient shim for local fastapi package. """ try: # If requests and starlette are available, a more realistic client could be used. pass except Exception: pass class TestClient: def __init__(self, app): self.app = app def get(self, path: str): for method, route_path, fn in getattr(self.app, '_routes', []): if method == 'GET' and route_path == path: result = fn() class Resp: status_code = 200 def json(self): return result return Resp() class Resp404: status_code = 404 def json(self): return {"detail": "Not Found"} return Resp404()