Spaces:
Sleeping
Sleeping
marintosti12 commited on
Commit ·
8afccd5
1
Parent(s): c742af8
fix(test) : fix unit test
Browse files- tests/unit/test_features.py +17 -0
tests/unit/test_features.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pandas as pd
|
| 2 |
+
import pytest
|
| 3 |
+
from features import compute_features
|
| 4 |
+
|
| 5 |
+
def test_compute_features_returns_matrix():
|
| 6 |
+
df = pd.DataFrame([{"age": 35, "genre": "Homme", "revenu_mensuel": 4200,
|
| 7 |
+
"satisfaction_employee_environnement": 3,
|
| 8 |
+
"satisfaction_employee_nature_travail": 3,
|
| 9 |
+
"satisfaction_employee_equipe": 3,
|
| 10 |
+
"satisfaction_employee_equilibre_pro_perso": 3, "note_evaluation_actuelle": 2, 'note_evaluation_precedente' : 3, "annes_sous_responsable_actuel" : 2, "annees_dans_le_poste_actuel" : 4, "niveau_hierarchique_poste": 2, "distance_domicile_travail" : 5}])
|
| 11 |
+
X = compute_features(df)
|
| 12 |
+
assert hasattr(X, "shape")
|
| 13 |
+
assert X.shape[0] == 1
|
| 14 |
+
|
| 15 |
+
def test_compute_features_raises_on_empty():
|
| 16 |
+
with pytest.raises(Exception):
|
| 17 |
+
compute_features(pd.DataFrame())
|