Repository: ibis-project/ibis-bigquery (language: python)

Issue:
update unit tests to support ibis 3.0.0
One thing that has changed is the default column expression names: https://github.com/ibis-project/ibis/pull/3755


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 29b913a..361df0f 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -59,9 +59,9 @@ jobs:
           - python_version: "3.8"
             "ibis_version": "2.1.1"
           - python_version: "3.9"
-            "ibis_version": "3.0.0"
+            "ibis_version": "3.0.2"
           - python_version: "3.10"
-            "ibis_version": "3.0.0"
+            "ibis_version": "3.0.2"
           - python_version: "3.10"
             "ibis_version": "github"
 


Test patch:
diff --git a/.github/workflows/system-tests-pr.yml b/.github/workflows/system-tests-pr.yml
index 16ae71f..a55330d 100644
--- a/.github/workflows/system-tests-pr.yml
+++ b/.github/workflows/system-tests-pr.yml
@@ -23,9 +23,9 @@ jobs:
           - python_version: "3.8"
             "ibis_version": "2.1.1"
           - python_version: "3.9"
-            "ibis_version": "3.0.0"
+            "ibis_version": "3.0.2"
           - python_version: "3.10"
-            "ibis_version": "3.0.0"
+            "ibis_version": "3.0.2"
           - python_version: "3.10"
             "ibis_version": "github"
 
diff --git a/.github/workflows/system-tests.yml b/.github/workflows/system-tests.yml
index d922760..e32ffd1 100644
--- a/.github/workflows/system-tests.yml
+++ b/.github/workflows/system-tests.yml
@@ -21,9 +21,9 @@ jobs:
           - python_version: "3.8"
             "ibis_version": "2.1.1"
           - python_version: "3.9"
-            "ibis_version": "3.0.0"
+            "ibis_version": "3.0.2"
           - python_version: "3.10"
-            "ibis_version": "3.0.0"
+            "ibis_version": "3.0.2"
           - python_version: "3.10"
             "ibis_version": "github"
 
diff --git a/tests/system/test_client.py b/tests/system/test_client.py
index cba0015..2aabc4d 100644
--- a/tests/system/test_client.py
+++ b/tests/system/test_client.py
@@ -17,6 +17,7 @@
 
 IBIS_VERSION = packaging.version.Version(ibis.__version__)
 IBIS_1_4_VERSION = packaging.version.Version("1.4.0")
+IBIS_3_0_VERSION = packaging.version.Version("3.0.0")
 
 
 def test_table(alltypes):
@@ -84,7 +85,8 @@ def test_compile_toplevel():
 def test_struct_field_access(struct_table):
     expr = struct_table.struct_col["string_field"]
     result = expr.execute()
-    expected = pd.Series([None, "a"], name="tmp")
+    expected_name = "tmp" if IBIS_VERSION < IBIS_3_0_VERSION else "string_field"
+    expected = pd.Series([None, "a"], name=expected_name)
     tm.assert_series_equal(result, expected)
 
 
diff --git a/tests/unit/test_compiler.py b/tests/unit/test_compiler.py
index 22970ba..f84d192 100644
--- a/tests/unit/test_compiler.py
+++ b/tests/unit/test_compiler.py
@@ -12,6 +12,7 @@
 
 IBIS_VERSION = packaging.version.Version(ibis.__version__)
 IBIS_1_4_VERSION = packaging.version.Version("1.4.0")
+IBIS_3_0_VERSION = packaging.version.Version("3.0.0")
 
 
 @pytest.mark.parametrize(
@@ -313,8 +314,9 @@ def test_binary():
     t = ibis.table([("value", "double")], name="t")
     expr = t["value"].cast(dt.binary).name("value_hash")
     result = ibis_bigquery.compile(expr)
-    expected = """\
-SELECT CAST(`value` AS BYTES) AS `tmp`
+    expected_name = "tmp" if IBIS_VERSION < IBIS_3_0_VERSION else "value_hash"
+    expected = f"""\
+SELECT CAST(`value` AS BYTES) AS `{expected_name}`
 FROM t"""
     assert result == expected
 
@@ -345,21 +347,22 @@ def test_bucket():
     buckets = [0, 1, 3]
     expr = t.value.bucket(buckets).name("foo")
     result = ibis_bigquery.compile(expr)
-    expected = """\
+    expected_name = "tmp" if IBIS_VERSION < IBIS_3_0_VERSION else "foo"
+    expected = f"""\
 SELECT
   CASE
     WHEN (0 <= `value`) AND (`value` < 1) THEN 0
     WHEN (1 <= `value`) AND (`value` <= 3) THEN 1
     ELSE CAST(NULL AS INT64)
-  END AS `tmp`
+  END AS `{expected_name}`
 FROM t"""
-    expected_2 = """\
+    expected_2 = f"""\
 SELECT
   CASE
     WHEN (`value` >= 0) AND (`value` < 1) THEN 0
     WHEN (`value` >= 1) AND (`value` <= 3) THEN 1
     ELSE CAST(NULL AS INT64)
-  END AS `tmp`
+  END AS `{expected_name}`
 FROM t"""
     assert result == expected or result == expected_2
 
@@ -376,10 +379,11 @@ def test_window_unbounded(kind, begin, end, expected):
     kwargs = {kind: (begin, end)}
     expr = t.a.sum().over(ibis.window(**kwargs))
     result = ibis_bigquery.compile(expr)
+    expected_name = "tmp" if IBIS_VERSION < IBIS_3_0_VERSION else "sum"
     assert (
         result
         == f"""\
-SELECT sum(`a`) OVER (ROWS BETWEEN {expected}) AS `tmp`
+SELECT sum(`a`) OVER (ROWS BETWEEN {expected}) AS `{expected_name}`
 FROM t"""
     )