Skip to content

Commit d1c312d

Browse files
authored
Merge pull request #31 from zbrookle/add_count
ENH: Add unit tests for count
2 parents 1765760 + d7c81a7 commit d1c312d

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

dataframe_sql/tests/pandas_sql_functionality_test.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,3 +1156,29 @@ def test_boolean_order_of_operations_with_parens():
11561156
].reset_index(drop=True)
11571157

11581158
tm.assert_frame_equal(pandas_frame, my_frame)
1159+
1160+
1161+
def test_count():
1162+
"""
1163+
Test count star
1164+
:return:
1165+
"""
1166+
my_frame = query("select count(day) from forest_fires")
1167+
pandas_frame = FOREST_FIRES.copy()
1168+
pandas_frame = (
1169+
pandas_frame[["month"]].count().to_frame("_col0").reset_index(drop=True)
1170+
)
1171+
tm.assert_frame_equal(pandas_frame, my_frame)
1172+
1173+
1174+
def test_count_star():
1175+
"""
1176+
Test the count aggregation
1177+
:return:
1178+
"""
1179+
my_frame = query("select count(*) from forest_fires")
1180+
pandas_frame = FOREST_FIRES.copy()
1181+
pandas_frame = (
1182+
pandas_frame[["month"]].count().to_frame("_col0").reset_index(drop=True)
1183+
)
1184+
tm.assert_frame_equal(pandas_frame, my_frame)

0 commit comments

Comments
 (0)