Spaces:
Sleeping
Sleeping
Download test_server.py from gruhit-patel/deployment_app: direct link, hf CLI and curl.
- Browser
- Download file 580 Bytes
-
https://huggingface.co/spaces/gruhit-patel/deployment_app/resolve/main/test_server.py
- Command line
-
hf download hf://spaces/gruhit-patel/deployment_app/test_server.py
-
curl -L -o test_server.py https://huggingface.co/spaces/gruhit-patel/deployment_app/resolve/main/test_server.py
580 Bytes
| from fastapi.testclient import TestClient | |
| import json | |
| from server import app | |
| client = TestClient(app) | |
| def test_read_app(): | |
| response = client.get("/") | |
| assert response.status_code == 200 | |
| assert response.json() == {"status": "House Price Prediction"} | |
| def test_predict_house_price(): | |
| response = client.post( | |
| "/predict_house_price", | |
| json={ | |
| 'medInc': 8.3252, | |
| 'houseAge': 41, | |
| 'avgRooms': 6.0, | |
| 'avgBdrms': 1.0, | |
| 'population': 1.0, | |
| 'avgOccup': 2.5, | |
| 'latitude': 37.88, | |
| 'longitude': -122.23, | |
| } | |
| ) | |
| assert response.status_code == 200 |