Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-stan committed Jun 6, 2024
1 parent f079a99 commit dc548c0
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/mock/test_column.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#
# Copyright (c) 2012-2024 Snowflake Computing Inc. All rights reserved.
#

from snowflake.snowpark.functions import col, when
from snowflake.snowpark.row import Row


def test_casewhen_with_non_zero_row_index(session):
df = session.create_dataframe([[1, 2], [3, 4]], schema=["a", "b"])
assert df.filter(col("a") > 1).select(
when(col("a").is_null(), 5).when(col("a") == 1, 6).otherwise(7).as_("a")
).collect() == [Row(A=7)]


def test_regexp_with_non_zero_row_index(session):
df = session.create_dataframe([["1", 2], ["3", 4]], schema=["a", "b"])
assert df.filter(col("b") > 2).select(
col("a").like("1").alias("res")
).collect() == [Row(RES=False)]

0 comments on commit dc548c0

Please sign in to comment.