-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move test dir in spaceflights-pandas one level down (#176)
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
- Loading branch information
Showing
4 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
29 changes: 29 additions & 0 deletions
29
spaceflights-pandas/{{ cookiecutter.repo_name }}/tests/pipelines/test_data_science.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.