Download tests/test_app.py from UNISM-SI/test: direct link, hf CLI and curl.
- Browser
- Download file 853 Bytes
-
https://huggingface.co/spaces/UNISM-SI/test/resolve/main/tests/test_app.py
- Command line
-
hf download hf://spaces/UNISM-SI/test/tests/test_app.py
-
curl -L -o test_app.py https://huggingface.co/spaces/UNISM-SI/test/resolve/main/tests/test_app.py
853 Bytes
| import pytest | |
| from app import app | |
| def client(): | |
| app.config.update({"TESTING": True}) | |
| with app.test_client() as client: | |
| yield client | |
| def test_index_page(client): | |
| resp = client.get("/") | |
| assert resp.status_code == 200 | |
| assert b"Komoditas logam" in resp.data | |
| def test_predict_invalid(client): | |
| resp = client.post("/predict", data={"commodity": "unknownmetal"}, follow_redirects=True) | |
| assert resp.status_code == 200 | |
| # Should flash an error message in Indonesian | |
| assert b"Tidak menemukan simbol" in resp.data or b"Data historis" in resp.data | |
| # Ensure templates only use ASCII in titles | |
| import re | |
| def test_ascii_titles(): | |
| with open("templates/base.html", "r", encoding="utf-8") as f: | |
| html = f.read() | |
| # Ensure no bullet character | |
| assert "\u2022" not in html | |
| # ======================= end tests/test_app.py =============================== |