Skip to content

Commit 05b4df9

Browse files
refactor: Do not emit any warnings in tests and treat warnings in tests as errors (#50)
1 parent a0158ce commit 05b4df9

3 files changed

Lines changed: 24 additions & 12 deletions

File tree

diffly/comparison.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,9 +1246,12 @@ def _list_length_exprs(
12461246
"""Collect max-list-length scalar expressions for every List level in the type
12471247
tree."""
12481248
if isinstance(dtype, pl.List):
1249-
return [expr.list.len().max(), *_list_length_exprs(expr.explode(), dtype.inner)]
1249+
return [
1250+
expr.list.len().max(),
1251+
*_list_length_exprs(expr.explode(empty_as_null=True), dtype.inner),
1252+
]
12501253
if isinstance(dtype, pl.Array):
1251-
return _list_length_exprs(expr.explode(), dtype.inner)
1254+
return _list_length_exprs(expr.explode(empty_as_null=True), dtype.inner)
12521255
if isinstance(dtype, pl.Struct):
12531256
return [
12541257
e

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,8 @@ default.extend-ignore-re = [
9696
addopts = "--import-mode=importlib -m 'not generate'"
9797
markers = ["generate: mark a test function as generating fixture output."]
9898
testpaths = ["tests"]
99+
filterwarnings = [
100+
"error",
101+
# polars' deprecation warning for horizontal concatenation cannot be solved, we are already using it correctly
102+
"ignore:the default behavior of `how='horizontal'` for `concat` is deprecated:DeprecationWarning",
103+
]

tests/test_fraction_same.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,24 @@ def test_missing_primary_key_fraction_same() -> None:
3030
@pytest.mark.parametrize("frame_type", FRAME_TYPES)
3131
@pytest.mark.parametrize(
3232
"dtypes_left",
33-
itertools.zip_longest(
34-
FLOAT_DTYPES,
35-
SIGNED_INTEGER_DTYPES,
36-
UNSIGNED_INTEGER_DTYPES,
37-
fillvalue=pl.Float32,
33+
list(
34+
itertools.zip_longest(
35+
FLOAT_DTYPES,
36+
SIGNED_INTEGER_DTYPES,
37+
UNSIGNED_INTEGER_DTYPES,
38+
fillvalue=pl.Float32,
39+
)
3840
),
3941
)
4042
@pytest.mark.parametrize(
4143
"dtypes_right",
42-
itertools.zip_longest(
43-
FLOAT_DTYPES,
44-
SIGNED_INTEGER_DTYPES,
45-
UNSIGNED_INTEGER_DTYPES,
46-
fillvalue=pl.Float32,
44+
list(
45+
itertools.zip_longest(
46+
FLOAT_DTYPES,
47+
SIGNED_INTEGER_DTYPES,
48+
UNSIGNED_INTEGER_DTYPES,
49+
fillvalue=pl.Float32,
50+
)
4751
),
4852
)
4953
@pytest.mark.parametrize("parallel", [True, False])

0 commit comments

Comments
 (0)