Tbruand
commited on
Commit
·
0cf4a6c
1
Parent(s):
880f334
test(handler): ajout d’un test unitaire pour le modèle few-shot
Browse files- tests/test_handler.py +12 -0
tests/test_handler.py
CHANGED
|
@@ -11,6 +11,18 @@ def test_zero_shot_prediction_output():
|
|
| 11 |
print("Résultat brut :", output)
|
| 12 |
|
| 13 |
# Vérifie que le format markdown est respecté
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
assert "### Résultat de la classification" in output
|
| 15 |
assert "**toxique**" in output
|
| 16 |
assert "**non-toxique**" in output
|
|
|
|
| 11 |
print("Résultat brut :", output)
|
| 12 |
|
| 13 |
# Vérifie que le format markdown est respecté
|
| 14 |
+
assert "### Résultat de la classification" in output
|
| 15 |
+
assert "**toxique**" in output
|
| 16 |
+
assert "**non-toxique**" in output
|
| 17 |
+
assert "%" in output
|
| 18 |
+
|
| 19 |
+
def test_few_shot_prediction_output():
|
| 20 |
+
from app.handler import predict
|
| 21 |
+
text = "Tu es un abruti fini"
|
| 22 |
+
output = predict(text, model_type="few-shot")
|
| 23 |
+
|
| 24 |
+
print("Résultat few-shot :", output)
|
| 25 |
+
|
| 26 |
assert "### Résultat de la classification" in output
|
| 27 |
assert "**toxique**" in output
|
| 28 |
assert "**non-toxique**" in output
|