Skip to content

Commit 3916225

Browse files
committed
address comments
1 parent 1eaa3e3 commit 3916225

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff/diff_bool.sql renamed to tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_bool/out.sql

File renamed without changes.

tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff/diff_datetime.sql renamed to tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_datetime/out.sql

File renamed without changes.

tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff/diff_int.sql renamed to tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_int/out.sql

File renamed without changes.

tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff/diff_timestamp.sql renamed to tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_timestamp/out.sql

File renamed without changes.

tests/unit/core/compile/sqlglot/aggregations/test_unary_compiler.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def test_dense_rank(scalar_types_df: bpd.DataFrame, snapshot):
214214
snapshot.assert_match(sql, "out.sql")
215215

216216

217-
def test_diff(scalar_types_df: bpd.DataFrame, snapshot):
217+
def test_diff_w_int(scalar_types_df: bpd.DataFrame, snapshot):
218218
# Test integer
219219
int_col = "int64_col"
220220
bf_df_int = scalar_types_df[[int_col]]
@@ -223,37 +223,40 @@ def test_diff(scalar_types_df: bpd.DataFrame, snapshot):
223223
agg_ops.DiffOp(periods=1), expression.deref(int_col)
224224
)
225225
int_sql = _apply_unary_window_op(bf_df_int, int_op, window, "diff_int")
226-
snapshot.assert_match(int_sql, "diff_int.sql")
226+
snapshot.assert_match(int_sql, "out.sql")
227227

228-
# Test boolean
228+
229+
def test_diff_w_bool(scalar_types_df: bpd.DataFrame, snapshot):
229230
bool_col = "bool_col"
230231
bf_df_bool = scalar_types_df[[bool_col]]
231232
window = window_spec.WindowSpec(ordering=(ordering.descending_over(bool_col),))
232233
bool_op = agg_exprs.UnaryAggregation(
233234
agg_ops.DiffOp(periods=1), expression.deref(bool_col)
234235
)
235236
bool_sql = _apply_unary_window_op(bf_df_bool, bool_op, window, "diff_bool")
236-
snapshot.assert_match(bool_sql, "diff_bool.sql")
237+
snapshot.assert_match(bool_sql, "out.sql")
238+
237239

238-
# Test date
240+
def test_diff_w_datetime(scalar_types_df: bpd.DataFrame, snapshot):
239241
col_name = "datetime_col"
240242
bf_df_date = scalar_types_df[[col_name]]
241243
window = window_spec.WindowSpec(ordering=(ordering.ascending_over(col_name),))
242244
op = agg_exprs.UnaryAggregation(
243245
agg_ops.DiffOp(periods=1), expression.deref(col_name)
244246
)
245247
sql = _apply_unary_window_op(bf_df_date, op, window, "diff_datetime")
246-
snapshot.assert_match(sql, "diff_datetime.sql")
248+
snapshot.assert_match(sql, "out.sql")
247249

248-
# Test date
250+
251+
def test_diff_w_timestamp(scalar_types_df: bpd.DataFrame, snapshot):
249252
col_name = "timestamp_col"
250253
bf_df_timestamp = scalar_types_df[[col_name]]
251254
window = window_spec.WindowSpec(ordering=(ordering.descending_over(col_name),))
252255
op = agg_exprs.UnaryAggregation(
253256
agg_ops.DiffOp(periods=1), expression.deref(col_name)
254257
)
255258
sql = _apply_unary_window_op(bf_df_timestamp, op, window, "diff_timestamp")
256-
snapshot.assert_match(sql, "diff_timestamp.sql")
259+
snapshot.assert_match(sql, "out.sql")
257260

258261

259262
def test_first(scalar_types_df: bpd.DataFrame, snapshot):

0 commit comments

Comments
 (0)