Spaces:
Runtime error
Runtime error
Aurélie GABU
commited on
Commit
·
ed72ddf
1
Parent(s):
d17f8e4
docs: tests_api.py indentation updated
Browse files- tests/test_api.py +35 -35
tests/test_api.py
CHANGED
|
@@ -5,40 +5,40 @@ client = TestClient(app)
|
|
| 5 |
|
| 6 |
def test_predict_endpoint():
|
| 7 |
|
| 8 |
-
emp_caract = {
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
|
| 40 |
-
response = client.post("/predict", json = emp_caract)
|
| 41 |
|
| 42 |
-
assert response.status_code == 200
|
| 43 |
-
assert "prediction" in response.json()
|
| 44 |
-
assert "probabilite_depart" in response.json()
|
|
|
|
| 5 |
|
| 6 |
def test_predict_endpoint():
|
| 7 |
|
| 8 |
+
emp_caract = {
|
| 9 |
+
"genre": "M",
|
| 10 |
+
"statut_marital": "Marié(e)",
|
| 11 |
+
"departement": "Commercial",
|
| 12 |
+
"poste": "Cadre Commercial",
|
| 13 |
+
"domaine_etude": "Infra & Cloud",
|
| 14 |
+
"frequence_deplacement": "Occasionnel",
|
| 15 |
+
"heure_supplementaires": "false",
|
| 16 |
+
"evolution_cat_evol": "hausse",
|
| 17 |
+
"categorie_employe": "employe-experimente",
|
| 18 |
+
"satisfaction_employee_nature_travail": 3,
|
| 19 |
+
"nombre_participation_pee": 0,
|
| 20 |
+
"ecart_note_evaluation": 1,
|
| 21 |
+
"revenu_mensuel": 10609,
|
| 22 |
+
"distance_domicile_travail": 1,
|
| 23 |
+
"satisfaction_globale": 2.00,
|
| 24 |
+
"niveau_education": 2,
|
| 25 |
+
"note_evaluation_actuelle": 3,
|
| 26 |
+
"satisfaction_employee_equipe": 3,
|
| 27 |
+
"age": 37,
|
| 28 |
+
"revenu_par_annee_experience_interne": 9093,
|
| 29 |
+
"satisfaction_employee_equilibre_pro_perso": 1,
|
| 30 |
+
"nombre_experiences_precedentes": 5,
|
| 31 |
+
"annees_dans_l_entreprise": 14,
|
| 32 |
+
"nb_formations_suivies": 2,
|
| 33 |
+
"revenu_par_annee_experience_totale": 7488,
|
| 34 |
+
"ratio_sans_promotion": 0,
|
| 35 |
+
"satisfaction_employee_environnement": 1,
|
| 36 |
+
"exp_hors_entreprise": 3,
|
| 37 |
+
"mobilite_promotion": -10,
|
| 38 |
+
"annees_depuis_la_derniere_promotion": 11}
|
| 39 |
|
| 40 |
+
response = client.post("/predict", json = emp_caract)
|
| 41 |
|
| 42 |
+
assert response.status_code == 200
|
| 43 |
+
assert "prediction" in response.json()
|
| 44 |
+
assert "probabilite_depart" in response.json()
|