Spaces:
Sleeping
Sleeping
Download tests/integration/test_train.py from Lordemarco/sentiment-fastapi: direct link, hf CLI and curl.
- Browser
- Download file 634 Bytes
-
https://huggingface.co/spaces/Lordemarco/sentiment-fastapi/resolve/main/tests/integration/test_train.py
- Command line
-
hf download hf://spaces/Lordemarco/sentiment-fastapi/tests/integration/test_train.py
-
curl -L -o test_train.py https://huggingface.co/spaces/Lordemarco/sentiment-fastapi/resolve/main/tests/integration/test_train.py
634 Bytes
| import os | |
| import shutil | |
| import pytest | |
| from src.train_model import train_model | |
| MODEL_DIR = "models/sentiment_model" | |
| def cleanup(): | |
| if os.path.exists(MODEL_DIR): | |
| shutil.rmtree(MODEL_DIR) | |
| yield | |
| if os.path.exists(MODEL_DIR): | |
| shutil.rmtree(MODEL_DIR) | |
| def test_train_model_runs(): | |
| """Testa che il training parta e salvi un modello.""" | |
| train_model(sample_train_size=10, sample_eval_size=5) | |
| assert os.path.exists(MODEL_DIR), "La directory del modello non è stata creata" | |
| assert os.path.exists(os.path.join(MODEL_DIR, "config.json")), "File config.json mancante" | |