Skip to content

Commit

Permalink
Move test dir in spaceflights-pandas one level down (#176)
Browse files Browse the repository at this point in the history
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
  • Loading branch information
merelcht authored Oct 31, 2023
1 parent ed01b27 commit de9c09a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import pandas as pd
import pytest
from {{ cookiecutter.python_package }}.pipelines.data_science.nodes import split_data


@pytest.fixture
def dummy_data():
return pd.DataFrame(
{"engines": [1, 2, 3],
"crew": [4, 5, 6],
"passenger_capacity": [5, 6, 7],
"price": [120, 290, 30]})

@pytest.fixture
def dummy_parameters():
parameters = {"model_options":
{"test_size": 0.2,
"random_state": 3,
"features": ["engines", "passenger_capacity", "crew"]}
}
return parameters

class TestDataScienceNodes:
def test_split_data(self, dummy_data, dummy_parameters):
X_train, X_test, y_train, y_test = split_data(dummy_data, dummy_parameters["model_options"])
assert len(X_train) == 2 # noqa: PLR2004
assert len(y_train) == 2 # noqa: PLR2004
assert len(X_test) == 1
assert len(y_test) == 1
File renamed without changes.

0 comments on commit de9c09a

Please sign in to comment.