From 1a16401205607f015cfe87f4a5ee12b7f4f1109a Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 24 Mar 2023 17:58:39 -0400 Subject: [PATCH] test(snowflake): fix arbitrary comparisons --- ibis/backends/tests/test_aggregation.py | 66 +++---------------------- ibis/backends/tests/test_generic.py | 30 +++-------- 2 files changed, 15 insertions(+), 81 deletions(-) diff --git a/ibis/backends/tests/test_aggregation.py b/ibis/backends/tests/test_aggregation.py index 936099e7d915..9ff5b5e8a111 100644 --- a/ibis/backends/tests/test_aggregation.py +++ b/ibis/backends/tests/test_aggregation.py @@ -551,14 +551,7 @@ def mean_and_std(v): lambda t, where: t.double_col[where].iloc[0], id='arbitrary_default', marks=pytest.mark.notimpl( - [ - 'impala', - 'mysql', - 'polars', - 'datafusion', - "mssql", - "druid", - ], + ['impala', 'mysql', 'polars', 'datafusion', "mssql", "druid"], raises=com.OperationNotDefinedError, ), ), @@ -567,14 +560,7 @@ def mean_and_std(v): lambda t, where: t.double_col[where].iloc[0], id='arbitrary_first', marks=pytest.mark.notimpl( - [ - 'impala', - 'mysql', - 'polars', - 'datafusion', - "mssql", - "druid", - ], + ['impala', 'mysql', 'polars', 'datafusion', "mssql", "druid"], raises=com.OperationNotDefinedError, ), ), @@ -584,29 +570,13 @@ def mean_and_std(v): id='arbitrary_last', marks=[ pytest.mark.notimpl( - [ - 'impala', - 'mysql', - 'polars', - 'datafusion', - "mssql", - "druid", - ], + ['impala', 'mysql', 'polars', 'datafusion', "mssql", "druid"], raises=com.OperationNotDefinedError, ), - pytest.mark.broken( - ["trino"], - raises=AssertionError, - ), pytest.mark.notimpl( - ["snowflake"], + ["bigquery", "snowflake", "trino"], raises=com.UnsupportedOperationError, - reason="Snowflake only supports the `first` option for `.arbitrary()", - ), - pytest.mark.notimpl( - ["bigquery"], - raises=com.UnsupportedOperationError, - reason="'last' value not supported for arbitrary in BigQuery", + reason="backend only supports the `first` option for `.arbitrary()", ), ], ), @@ -711,14 +681,7 @@ def mean_and_std(v): id="collect", marks=[ mark.notimpl( - [ - "impala", - "mysql", - "sqlite", - "datafusion", - "mssql", - "druid", - ], + ["impala", "mysql", "sqlite", "datafusion", "mssql", "druid"], raises=com.OperationNotDefinedError, ), pytest.mark.broken( @@ -941,12 +904,7 @@ def test_quantile( raises=com.OperationNotDefinedError, ), pytest.mark.notyet( - [ - "impala", - "mysql", - "sqlite", - "polars", - ], + ["impala", "mysql", "sqlite", "polars"], raises=com.OperationNotDefinedError, ), pytest.mark.notyet( @@ -1047,15 +1005,7 @@ def test_corr_cov( @pytest.mark.notimpl( - [ - "datafusion", - "mysql", - "postgres", - "sqlite", - "snowflake", - "mssql", - "druid", - ], + ["datafusion", "mysql", "postgres", "sqlite", "snowflake", "mssql", "druid"], raises=com.OperationNotDefinedError, ) @pytest.mark.broken( diff --git a/ibis/backends/tests/test_generic.py b/ibis/backends/tests/test_generic.py index c5011b8ece8d..96e77c9bc5d1 100644 --- a/ibis/backends/tests/test_generic.py +++ b/ibis/backends/tests/test_generic.py @@ -1025,31 +1025,15 @@ def test_pivot_longer(backend): @pytest.mark.parametrize( "keep", [ + "first", param( - "first", + "last", marks=pytest.mark.notimpl( - ["trino"], - raises=AssertionError, - reason="trino is more arbitrary than other backends", - strict=False, + ["bigquery", "snowflake", "trino"], + raises=com.UnsupportedOperationError, + reason="backend doesn't support how='last'", ), ), - param( - "last", - marks=[ - pytest.mark.notimpl( - ["bigquery", "snowflake"], - raises=com.UnsupportedOperationError, - reason="backend doesn't support last argument to arbitrary", - ), - pytest.mark.notimpl( - ["trino"], - raises=AssertionError, - reason="trino is more arbitrary than other backends", - strict=False, - ), - ], - ), ], ) @pytest.mark.notimpl( @@ -1086,7 +1070,7 @@ def test_distinct_on_keep(backend, on, keep): .sort_values(by=["idx"]) .reset_index(drop=True) ) - backend.assert_frame_equal(result, expected) + assert len(result) == len(expected) @pytest.mark.parametrize( @@ -1151,4 +1135,4 @@ def test_distinct_on_keep_is_none(backend, on): .sort_values(by=["idx"]) .reset_index(drop=True) ) - backend.assert_frame_equal(result, expected) + assert len(result) == len(expected)