Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNOW-1320674: Add tests to verify loc raises KeyError for invalid labels #2293

Merged
merged 1 commit into from
Sep 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions tests/integ/modin/frame/test_loc.py
Original file line number Diff line number Diff line change
Expand Up @@ -4072,3 +4072,22 @@ def test_df_loc_get_with_timedelta_and_none_key():
# Compare with an empty DataFrame, since native pandas raises a KeyError.
expected_df = native_pd.DataFrame()
assert_frame_equal(snow_df.loc[None], expected_df, check_column_type=False)


@sql_count_checker(query_count=0)
def test_df_loc_invalid_key():
# Bug fix: SNOW-1320674
native_df = native_pd.DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]})
snow_df = pd.DataFrame(native_df)

def op(df):
df["C"] = df["A"] / df["D"]

eval_snowpark_pandas_result(
snow_df,
native_df,
op,
expect_exception=True,
expect_exception_type=KeyError,
expect_exception_match="D",
)
Loading