From d597e376d0d9f568df39061be768f7ea4f790153 Mon Sep 17 00:00:00 2001 From: Nick Crews Date: Wed, 24 Apr 2024 11:04:11 -0800 Subject: [PATCH] test: re-add tests for deprecated .case --- ibis/backends/tests/test_generic.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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" )