Spaces:
Sleeping
Sleeping
Update tests/test_utils.py
Browse files- tests/test_utils.py +29 -0
tests/test_utils.py
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Testes simples para as funções de utilidade.
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
import pandas as pd
|
| 6 |
+
|
| 7 |
+
from src.utils import preparar_base
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def test_preparar_base_basico():
|
| 11 |
+
"""
|
| 12 |
+
Testa se a função preparar_base retorna shapes válidos.
|
| 13 |
+
"""
|
| 14 |
+
# Pequeno DataFrame de exemplo
|
| 15 |
+
dados = {
|
| 16 |
+
"ID": [1, 2, 3, 4],
|
| 17 |
+
"Income": [1000.0, 2000.0, 1500.0, 1800.0],
|
| 18 |
+
"Complain": [0, 1, 0, 1],
|
| 19 |
+
"Dt_Customer": ["01-01-2020", "05-01-2020", "10-01-2020", "15-01-2020"],
|
| 20 |
+
}
|
| 21 |
+
df = pd.DataFrame(dados)
|
| 22 |
+
|
| 23 |
+
X_train, X_test, y_train, y_test, features, scaler = preparar_base(
|
| 24 |
+
df, aplicar_smote=False, teste=0.5, random_state=42
|
| 25 |
+
)
|
| 26 |
+
|
| 27 |
+
assert X_train.shape[0] == y_train.shape[0]
|
| 28 |
+
assert X_test.shape[0] == y_test.shape[0]
|
| 29 |
+
assert len(features) > 0
|