Skip to content

Commit 3d92e0d

Browse files
authored
ci: Fix TPCH test data generation in CI (#2470)
* ci: Fix TPCH test data generation in CI * pandas-nullable fixup
1 parent a5e2e2f commit 3d92e0d

File tree

4 files changed

+23
-33
lines changed

4 files changed

+23
-33
lines changed

tests/expr_and_series/is_finite_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def test_is_finite_expr(constructor: Constructor) -> None:
2121
):
2222
expected = {"a": [False, False, True, False]}
2323
else: # pandas_nullable_constructor, pandas_pyarrow_constructor, modin_pyarrrow_constructor
24+
# Here, the 'nan' and None get mangled upon dataframe construction.
2425
expected = {"a": [None, False, True, None]}
2526

2627
df = nw.from_native(constructor(data))

tests/expr_and_series/str/to_uppercase_to_lowercase_test.py

Lines changed: 20 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,27 @@
2020
"ςpecial caσe", # noqa: RUF001
2121
]
2222
},
23-
{"a": ["SPECIAL CASE SS", "ΣPECIAL CAΣE"]},
23+
{"a": ["SPECIAL CASE ", "ΣPECIAL CAΣE"]},
2424
),
2525
],
2626
)
2727
def test_str_to_uppercase(
2828
constructor: Constructor,
2929
data: dict[str, list[str]],
3030
expected: dict[str, list[str]],
31-
request: pytest.FixtureRequest,
3231
) -> None:
33-
if any("ß" in s for value in data.values() for s in value) & (
34-
constructor.__name__
35-
in {
36-
"pandas_pyarrow_constructor",
37-
"pyarrow_table_constructor",
38-
"modin_pyarrow_constructor",
39-
"duckdb_lazy_constructor",
40-
"sqlframe_pyspark_lazy_constructor",
41-
}
42-
or ("dask" in str(constructor) and PYARROW_VERSION >= (12,))
32+
if "dask" in str(constructor) and PYARROW_VERSION < (12,):
33+
pytest.skip()
34+
35+
if (
36+
any(
37+
x in str(constructor)
38+
for x in ("pandas_constructor", "pandas_nullable", "polars")
39+
)
40+
and "ẞ" in expected["a"][0]
4341
):
44-
# We are marking it xfail for these conditions above
45-
# since the pyarrow backend will convert
46-
# smaller cap 'ß' to upper cap 'ẞ' instead of 'SS'
47-
request.applymarker(pytest.mark.xfail)
42+
expected = {"a": ["SPECIAL CASE SS", "ΣPECIAL CAΣE"]}
43+
4844
df = nw.from_native(constructor(data))
4945
result_frame = df.select(nw.col("a").str.to_uppercase())
5046

@@ -62,33 +58,25 @@ def test_str_to_uppercase(
6258
"ςpecial caσe", # noqa: RUF001
6359
]
6460
},
65-
{"a": ["SPECIAL CASE SS", "ΣPECIAL CAΣE"]},
61+
{"a": ["SPECIAL CASE ", "ΣPECIAL CAΣE"]},
6662
),
6763
],
6864
)
6965
def test_str_to_uppercase_series(
7066
constructor_eager: ConstructorEager,
7167
data: dict[str, list[str]],
7268
expected: dict[str, list[str]],
73-
request: pytest.FixtureRequest,
7469
) -> None:
7570
df = nw.from_native(constructor_eager(data), eager_only=True)
7671

77-
if any("ß" in s for value in data.values() for s in value) & (
78-
constructor_eager.__name__
79-
not in {
80-
"pandas_constructor",
81-
"pandas_nullable_constructor",
82-
"polars_eager_constructor",
83-
"cudf_constructor",
84-
"duckdb_lazy_constructor",
85-
"modin_constructor",
86-
}
72+
if (
73+
any(
74+
x in str(constructor_eager)
75+
for x in ("pandas_constructor", "pandas_nullable", "polars")
76+
)
77+
and "ẞ" in expected["a"][0]
8778
):
88-
# We are marking it xfail for these conditions above
89-
# since the pyarrow backend will convert
90-
# smaller cap 'ß' to upper cap 'ẞ' instead of 'SS'
91-
request.applymarker(pytest.mark.xfail)
79+
expected = {"a": ["SPECIAL CASE SS", "ΣPECIAL CAΣE"]}
9280

9381
result_series = df["a"].str.to_uppercase()
9482
assert_equal_data({"a": result_series}, expected)

tests/selectors_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ def test_set_ops(
224224
request: pytest.FixtureRequest,
225225
) -> None:
226226
if ("duckdb" in str(constructor) or "sqlframe" in str(constructor)) and not expected:
227+
# https://github.com/narwhals-dev/narwhals/issues/2469
227228
request.applymarker(pytest.mark.xfail)
228229
df = nw.from_native(constructor(data))
229230
result = df.select(selector).collect_schema().names()

tpch/generate_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
tbl_arrow = tbl.to_arrow_table()
3131
new_schema = []
3232
for field in tbl_arrow.schema:
33-
if isinstance(field.type, type(pa.decimal128(1))):
33+
if isinstance(field.type, type(pa.decimal64(1))):
3434
new_schema.append(pa.field(field.name, pa.float64()))
3535
elif field.type == pa.date32():
3636
new_schema.append(pa.field(field.name, pa.timestamp("ns")))

0 commit comments

Comments
 (0)