diff --git a/ibis/backends/tests/test_generic.py b/ibis/backends/tests/test_generic.py index d95864c1061aa..d0533683e0281 100644 --- a/ibis/backends/tests/test_generic.py +++ b/ibis/backends/tests/test_generic.py @@ -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" )