From: Alexandru Ardelean Date: Sun, 9 Aug 2026 09:40:50 +0000 (+0300) Subject: python-starlette: add test script X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=64b87f014586cdba51b6f82caf5bd032d3d75b6c;p=openwrt-packages.git python-starlette: add test script Add a CI test.sh exercising basic package functionality. Signed-off-by: Alexandru Ardelean --- diff --git a/lang/python/python-starlette/test.sh b/lang/python/python-starlette/test.sh new file mode 100755 index 000000000..f515479e4 --- /dev/null +++ b/lang/python/python-starlette/test.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +[ "$1" = python3-starlette ] || exit 0 + +python3 - << 'EOF' + +from starlette.applications import Starlette +from starlette.responses import JSONResponse, PlainTextResponse +from starlette.routing import Route + +# Render responses (no server or event loop needed) and build an app with a +# route, exercising the response encoders and the router. +assert JSONResponse({"a": 1}).body == b'{"a":1}' +assert PlainTextResponse("hi").body == b"hi" + +async def home(request): + return JSONResponse({"ok": True}) + +app = Starlette(routes=[Route("/", home)]) +assert any(getattr(r, "path", None) == "/" for r in app.routes) + +EOF