Skip to content

Commit 6ffee2e

Browse files
committed
CLN: Move marker to different file
1 parent dca4cda commit 6ffee2e

2 files changed

Lines changed: 28 additions & 29 deletions

File tree

dataframe_sql/tests/markers.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from ibis.common.exceptions import OperationNotDefinedError
2+
import pytest
3+
4+
ibis_not_implemented = pytest.mark.xfail(
5+
raises=(OperationNotDefinedError, NotImplementedError),
6+
reason="Not implemented in ibis",
7+
)

dataframe_sql/tests/pandas_sql_functionality_test.py

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
register_env_tables,
2121
remove_env_tables,
2222
)
23+
from dataframe_sql.tests.markers import ibis_not_implemented
2324

2425

2526
@pytest.fixture(autouse=True, scope="module")
@@ -372,10 +373,10 @@ def test_having_multiple_conditions():
372373
pandas_frame = aggregated_df[aggregated_df["_col0"] > 2]
373374
tm.assert_frame_equal(pandas_frame, my_frame)
374375

376+
375377
@pytest.mark.xfail(
376-
raises=ValueError,
377-
reason="Still can't do having without a group by in ibis",
378-
)
378+
raises=ValueError, reason="Still can't do having without a group by in ibis",
379+
)
379380
def test_having_one_condition():
380381
"""
381382
Test having clause
@@ -463,7 +464,10 @@ def test_select_columns_from_two_tables_with_same_column_name():
463464
renamed[column] = "table2." + column.replace("_y", "")
464465
pandas_frame.rename(columns=renamed, inplace=True)
465466

466-
tm.assert_frame_equal(pandas_frame, my_frame)
467+
tm.assert_frame_equal(
468+
pandas_frame.sort_values(by=list(pandas_frame.columns), kind="mergesort"),
469+
my_frame.sort_values(by=list(my_frame.columns), kind="mergesort"),
470+
)
467471

468472

469473
def test_maintain_case_in_query():
@@ -547,8 +551,8 @@ def test_union_all(pandas_frame1_for_set_ops, pandas_frame2_for_set_ops):
547551
).reset_index(drop=True)
548552
tm.assert_frame_equal(pandas_frame, my_frame)
549553

550-
@pytest.mark.xfail(raises=NotImplementedError, reason="Waiting on ibis for "
551-
"implementation")
554+
555+
@ibis_not_implemented
552556
def test_intersect_distinct(pandas_frame1_for_set_ops, pandas_frame2_for_set_ops):
553557
"""
554558
Test union distinct in queries
@@ -569,8 +573,8 @@ def test_intersect_distinct(pandas_frame1_for_set_ops, pandas_frame2_for_set_ops
569573
)
570574
tm.assert_frame_equal(pandas_frame, my_frame)
571575

572-
@pytest.mark.xfail(raises=NotImplementedError, reason="Waiting on ibis for "
573-
"implementation")
576+
577+
@ibis_not_implemented()
574578
def test_except_distinct(pandas_frame1_for_set_ops, pandas_frame2_for_set_ops):
575579
"""
576580
Test except distinct in queries
@@ -592,8 +596,8 @@ def test_except_distinct(pandas_frame1_for_set_ops, pandas_frame2_for_set_ops):
592596
)
593597
tm.assert_frame_equal(pandas_frame, my_frame)
594598

595-
@pytest.mark.xfail(raises=NotImplementedError, reason="Waiting on ibis for "
596-
"implementation")
599+
600+
@ibis_not_implemented
597601
def test_except_all(pandas_frame1_for_set_ops, pandas_frame2_for_set_ops):
598602
"""
599603
Test except distinct in queries
@@ -743,6 +747,7 @@ def test_case_statement_w_other_columns_as_result():
743747
tm.assert_frame_equal(pandas_frame, my_frame)
744748

745749

750+
@ibis_not_implemented
746751
def test_rank_statement_one_column():
747752
"""
748753
Test rank statement
@@ -759,6 +764,7 @@ def test_rank_statement_one_column():
759764
tm.assert_frame_equal(pandas_frame, my_frame)
760765

761766

767+
@ibis_not_implemented
762768
def test_rank_statement_many_columns():
763769
"""
764770
Test rank statement
@@ -797,6 +803,7 @@ def test_rank_statement_many_columns():
797803
tm.assert_frame_equal(pandas_frame, my_frame)
798804

799805

806+
@ibis_not_implemented
800807
def test_dense_rank_statement_many_columns():
801808
"""
802809
Test dense_rank statement
@@ -834,6 +841,7 @@ def test_dense_rank_statement_many_columns():
834841
tm.assert_frame_equal(pandas_frame, my_frame)
835842

836843

844+
@ibis_not_implemented
837845
def test_rank_over_partition_by():
838846
"""
839847
Test rank partition by statement
@@ -888,6 +896,7 @@ def test_rank_over_partition_by():
888896
tm.assert_frame_equal(pandas_frame, my_frame)
889897

890898

899+
@ibis_not_implemented
891900
def test_dense_rank_over_partition_by():
892901
"""
893902
Test rank partition by statement
@@ -1057,14 +1066,14 @@ def test_sql_data_types():
10571066
)
10581067

10591068
pandas_frame = AVOCADO.copy()[["avocado_id", "Date", "region"]]
1060-
pandas_frame["avocado_id_object"] = pandas_frame["avocado_id"].astype("object")
1069+
pandas_frame["avocado_id_object"] = pandas_frame["avocado_id"].apply(str)
10611070
pandas_frame["avocado_id_int16"] = pandas_frame["avocado_id"].astype("int16")
10621071
pandas_frame["avocado_id_smallint"] = pandas_frame["avocado_id"].astype("int16")
10631072
pandas_frame["avocado_id_int32"] = pandas_frame["avocado_id"].astype("int32")
10641073
pandas_frame["avocado_id_int"] = pandas_frame["avocado_id"].astype("int32")
10651074
pandas_frame["avocado_id_int64"] = pandas_frame["avocado_id"].astype("int64")
10661075
pandas_frame["avocado_id_bigint"] = pandas_frame["avocado_id"].astype("int64")
1067-
pandas_frame["avocado_id_float"] = pandas_frame["avocado_id"].astype("float")
1076+
pandas_frame["avocado_id_float"] = pandas_frame["avocado_id"].astype("float32")
10681077
pandas_frame["avocado_id_float16"] = pandas_frame["avocado_id"].astype("float16")
10691078
pandas_frame["avocado_id_float32"] = pandas_frame["avocado_id"].astype("float32")
10701079
pandas_frame["avocado_id_float64"] = pandas_frame["avocado_id"].astype("float64")
@@ -1134,20 +1143,3 @@ def test_boolean_order_of_operations_with_parens():
11341143

11351144
tm.assert_frame_equal(pandas_frame, my_frame)
11361145

1137-
1138-
if __name__ == "__main__":
1139-
register_env_tables()
1140-
#
1141-
# frame1 = FOREST_FIRES.copy().sort_values(by=["wind"], ascending=[False],
1142-
# kind="mergesort").head(
1143-
# 5).reset_index(drop=True)
1144-
# frame2 = FOREST_FIRES.copy().sort_values(by=["wind"], ascending=[True],
1145-
# kind="mergesort"
1146-
# ).head(5).reset_index(drop=True)
1147-
# print("pandas first\n", frame1)
1148-
# print("my first\n", query("select * from forest_fires order by wind desc limit 5"))
1149-
# print("pandas second\n", frame2)
1150-
# print("my second\n", query("select * from forest_fires order by wind asc limit 5"))
1151-
test_select_star_from_multiple_tables()
1152-
1153-
remove_env_tables()

0 commit comments

Comments
 (0)