Skip to content

Commit 35195e2

Browse files
author
Eloi Massoulié
committed
More specific test
1 parent 26abe8b commit 35195e2

1 file changed

Lines changed: 23 additions & 12 deletions

File tree

skrub/tests/test_table_vectorizer.py

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
from skrub._to_float import ToFloat
2929
from skrub._to_str import ToStr
3030
from skrub.conftest import _POLARS_INSTALLED
31-
from skrub.datasets._generating import toy_cities
3231

3332
MSG_PANDAS_DEPRECATED_WARNING = "Skip deprecation warning"
3433

@@ -1281,26 +1280,38 @@ def test_duration_to_float(df_module):
12811280

12821281

12831282
def test_list_transformations(df_module):
1284-
df = toy_cities()
1283+
df = df_module.make_dataframe(
1284+
{
1285+
"numbers": [1, 2, 3, 4, 5, 6, None],
1286+
"low_card": ["up", "up", "up", "down", "down", "up", "down"],
1287+
"datetime": [
1288+
"2026-06-01",
1289+
"2026-06-04",
1290+
"2026-07-03",
1291+
"2026-05-29",
1292+
"2026-01-08",
1293+
"2026-06-20",
1294+
None,
1295+
],
1296+
}
1297+
)
12851298

12861299
vectorizer = TableVectorizer()
12871300
_ = vectorizer.fit_transform(df)
12881301
vectorizer_output = vectorizer.list_transformations()
12891302
assert vectorizer_output == (
1290-
"Columns with standardized nulls:\n\tuid\n\tcities\nColumns "
1291-
"transformed to datetime:\n\tstart\n\tend\n\n\nnumeric transformer"
1292-
" is PassThrough and was applied to:\n\tencoded_cities\n\tmetric_0"
1293-
"\n\tmetric_1\n\tmetric_2\n\tmetric_3\ndatetime transformer is "
1294-
"DatetimeEncoder and was applied to:\n\tstart\n\tend\nlow_cardinality"
1295-
" transformer is OneHotEncoder and was applied to:\n\tcities\n"
1296-
"high_cardinality transformer is StringEncoder and was applied "
1297-
"to:\n\tuid\n\n\n"
1303+
"Columns with standardized nulls:\n\tlow_card\n\tdatetime\nColumns "
1304+
"transformed to datetime:\n\tdatetime\n\n\nnumeric transformer is "
1305+
"PassThrough and was applied to:\n\tnumbers\ndatetime transformer "
1306+
"is DatetimeEncoder and was applied to:\n\tdatetime\nlow_cardinality "
1307+
"transformer is OneHotEncoder and was applied to:\n\tlow_card\n"
1308+
"No high_cardinality columns have been detected.\n\n\n"
12981309
)
12991310

13001311
vectorizer = Cleaner()
13011312
_ = vectorizer.fit_transform(df)
13021313
cleaner_output = vectorizer.list_transformations()
13031314
assert (
1304-
cleaner_output == "Columns with standardized nulls:\n\tuid\n\tcities\nColumns "
1305-
"transformed to datetime:\n\tstart\n\tend\n"
1315+
cleaner_output == "Columns with standardized nulls:\n\tlow_card\n\t"
1316+
"datetime\nColumns transformed to datetime:\n\tdatetime\n"
13061317
)

0 commit comments

Comments
 (0)