Skip to content

Commit

Permalink
test: re-add tests for deprecated .case
Browse files Browse the repository at this point in the history
  • Loading branch information
NickCrews committed Apr 24, 2024
1 parent 2bc9121 commit d597e37
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ibis/backends/tests/test_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2010,6 +2010,21 @@ def test_switch_cases_null(con):
assert con.execute(e) == "expected"


def test_case(con):
# just to make sure that the deprecated .case() method still works
with pytest.warns(FutureWarning, match=".cases"):
assert con.execute(ibis.case().when(True, "yes").end()) == "yes"
assert pd.isna(con.execute(ibis.case().when(False, "yes").end()))
assert con.execute(ibis.case().when(False, "yes").else_("no").end()) == "no"

assert con.execute(ibis.literal("a").case().when("a", "yes").end()) == "yes"
assert pd.isna(con.execute(ibis.literal("a").case().when("b", "yes").end()))
assert (
con.execute(ibis.literal("a").case().when("b", "yes").else_("no").end())
== "no"
)


@pytest.mark.notimpl(
["dask", "pandas", "polars"], raises=NotImplementedError, reason="not a SQL backend"
)
Expand Down

0 comments on commit d597e37

Please sign in to comment.