Skip to content

Commit 478489e

Browse files
committed
Add test for type of single column selection.
1 parent 31714cc commit 478489e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/test_dataframe_mapper.py

+11
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,17 @@ def test_with_iris_dataframe(iris_dataframe):
5151
assert (scores.std() * 2) < 0.04
5252

5353

54+
def test_get_col_subset_single_column_array(iris_dataframe):
55+
"""
56+
Selecting a single column should return a 1-dimensional numpy array.
57+
"""
58+
mapper = DataFrameMapper(None)
59+
array = mapper._get_col_subset(iris_dataframe, "species")
60+
61+
assert type(array) == np.ndarray
62+
assert array.shape == (len(iris_dataframe["species"]),)
63+
64+
5465
def test_with_car_dataframe(cars_dataframe):
5566
pipeline = Pipeline([
5667
("preprocess", DataFrameMapper([

0 commit comments

Comments
 (0)