Skip to content

Commit

Permalink
Add additional test cases for resolve_mask_i()
Browse files Browse the repository at this point in the history
  • Loading branch information
jrycw committed Dec 17, 2024
1 parent eb62e34 commit e2d150d
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/test_tab_create_modify.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,23 @@ def test_tab_style_loc_body_mask_not_polars_expression_raises(gt2: GT):
with pytest.raises(ValueError) as exc_info:
tab_style(gt2, style, LocBody(mask=mask))
assert err_msg in exc_info.value.args[0]


def test_tab_style_loc_body_mask_columns_not_inside_raises(gt2: GT):
style = CellStyleFill(color="blue")
mask = pl.len()
err_msg = "The `mask` may reference columns not in the original DataFrame."

with pytest.raises(ValueError) as exc_info:
tab_style(gt2, style, LocBody(mask=mask))
assert err_msg in exc_info.value.args[0]


def test_tab_style_loc_body_mask_rows_not_equal_raises(gt2: GT):
style = CellStyleFill(color="blue")
mask = pl.len().alias("x")
err_msg = "The DataFrame length after applying `mask` differs from the original."

with pytest.raises(ValueError) as exc_info:
tab_style(gt2, style, LocBody(mask=mask))
assert err_msg in exc_info.value.args[0]

0 comments on commit e2d150d

Please sign in to comment.