Skip to content

Commit 5419351

Browse files
test: Assert max list length in condition tests
1 parent ab746e9 commit 5419351

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

tests/test_conditions.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,30 @@
77
import pytest
88

99
from diffly._conditions import _can_compare_dtypes, condition_equal_columns
10+
from diffly.comparison import compare_frames
1011

1112

1213
def test_condition_equal_columns_struct() -> None:
1314
# Arrange
1415
lhs = pl.DataFrame(
1516
{
1617
"pk": [1, 2],
17-
"a_left": [{"x": 1.0, "y": 2.0}, {"x": 2.0, "y": 2.1}],
18+
"a": [{"x": 1.0, "y": 2.0}, {"x": 2.0, "y": 2.1}],
1819
}
1920
)
2021
rhs = pl.DataFrame(
2122
{
2223
"pk": [1, 2],
23-
"a_right": [{"y": 2.0, "x": 1.1}, {"y": 2.7, "x": 2.1}],
24+
"a": [{"y": 2.0, "x": 1.1}, {"y": 2.7, "x": 2.1}],
2425
}
2526
)
2627

28+
c = compare_frames(lhs, rhs, primary_key="pk", abs_tol=0.5, rel_tol=0)
29+
assert c._max_list_lengths_by_column == {}
30+
2731
# Act
32+
lhs = lhs.rename({"a": "a_left"})
33+
rhs = rhs.rename({"a": "a_right"})
2834
actual = (
2935
lhs.join(rhs, on="pk", maintain_order="left")
3036
.select(
@@ -33,8 +39,8 @@ def test_condition_equal_columns_struct() -> None:
3339
dtype_left=lhs.schema["a_left"],
3440
dtype_right=rhs.schema["a_right"],
3541
max_list_length=None,
36-
abs_tol=0.5,
37-
rel_tol=0,
42+
abs_tol=c.abs_tol_by_column["a"],
43+
rel_tol=c.rel_tol_by_column["a"],
3844
)
3945
)
4046
.to_series()

0 commit comments

Comments
 (0)