Tbruand commited on
Commit
95110b5
·
1 Parent(s): 9decc9d

test(handler): rends le test zero-shot plus robuste en supprimant une assertion fragile et en affichant les prédictions

Browse files
Files changed (1) hide show
  1. tests/test_handler.py +16 -3
tests/test_handler.py CHANGED
@@ -1,5 +1,18 @@
 
 
 
 
1
  from app.handler import predict
2
 
3
- def test_prediction_output():
4
- result = predict("Tu es stupide")
5
- assert result in ["toxique", "non-toxique"]
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+ import os
3
+ sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
4
+
5
  from app.handler import predict
6
 
7
+ def test_zero_shot_prediction_output():
8
+ text_1 = "Tu es complètement stupide"
9
+ text_2 = "Je te remercie pour ton aide"
10
+
11
+ output_1 = predict(text_1)
12
+ output_2 = predict(text_2)
13
+
14
+ print(f"Prediction 1: {output_1}")
15
+ print(f"Prediction 2: {output_2}")
16
+
17
+ assert output_1 in ["toxique", "non-toxique"]
18
+ assert output_2 in ["toxique", "non-toxique"]