Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into issue_5925
Browse files Browse the repository at this point in the history
  • Loading branch information
dchigarev committed Jan 29, 2024
2 parents 1aba0fa + fb4a19f commit abafbda
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
4 changes: 2 additions & 2 deletions modin/experimental/pandas/test/test_io_exp.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ def test_read_csv_empty_frame(self):
df_equals(modin_df, pandas_df)

def test_read_csv_without_glob(self):
with pytest.warns(UserWarning, match=r"Shell-style wildcard"):
with pytest.raises(FileNotFoundError):
with pytest.raises(FileNotFoundError):
with warns_that_defaulting_to_pandas():
pd.read_csv_glob(
"s3://dask-data/nyc-taxi/2015/yellow_tripdata_2015-",
storage_options={"anon": True},
Expand Down
10 changes: 5 additions & 5 deletions modin/pandas/test/test_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,15 +295,15 @@ def test_merge_asof_bad_arguments():
modin_left, modin_right = pd.DataFrame(left), pd.DataFrame(right)

# Can't mix by with left_by/right_by
with pytest.raises(ValueError), warns_that_defaulting_to_pandas():
with pytest.raises(ValueError):
pandas.merge_asof(
pandas_left, pandas_right, on="a", by="b", left_by="can't do with by"
)
with pytest.raises(ValueError), warns_that_defaulting_to_pandas():
pd.merge_asof(
modin_left, modin_right, on="a", by="b", left_by="can't do with by"
)
with pytest.raises(ValueError), warns_that_defaulting_to_pandas():
with pytest.raises(ValueError):
pandas.merge_asof(
pandas_left, pandas_right, by="b", on="a", right_by="can't do with by"
)
Expand All @@ -313,11 +313,11 @@ def test_merge_asof_bad_arguments():
)

# Can't mix on with left_on/right_on
with pytest.raises(ValueError), warns_that_defaulting_to_pandas():
with pytest.raises(ValueError):
pandas.merge_asof(pandas_left, pandas_right, on="a", left_on="can't do with by")
with pytest.raises(ValueError), warns_that_defaulting_to_pandas():
pd.merge_asof(modin_left, modin_right, on="a", left_on="can't do with by")
with pytest.raises(ValueError), warns_that_defaulting_to_pandas():
with pytest.raises(ValueError):
pandas.merge_asof(
pandas_left, pandas_right, on="a", right_on="can't do with by"
)
Expand Down Expand Up @@ -347,7 +347,7 @@ def test_merge_asof_bad_arguments():
pandas.merge_asof(pandas_left, pandas_right, right_on="a")
with pytest.raises(ValueError), warns_that_defaulting_to_pandas():
pd.merge_asof(modin_left, modin_right, right_on="a")
with pytest.raises(ValueError), warns_that_defaulting_to_pandas():
with pytest.raises(ValueError):
pandas.merge_asof(pandas_left, pandas_right)
with pytest.raises(ValueError), warns_that_defaulting_to_pandas():
pd.merge_asof(modin_left, modin_right)
Expand Down
15 changes: 9 additions & 6 deletions modin/pandas/test/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,18 @@ def inter_df_math_helper_one_side(
)
modin_df_multi_level = modin_series.copy()
modin_df_multi_level.index = new_idx

# When 'level' parameter is passed, modin's implementation must raise a default-to-pandas warning,
# here we first detect whether 'op' takes 'level' parameter at all and only then perform the warning check
# reasoning: https://github.com/modin-project/modin/issues/6893
try:
# Defaults to pandas
with warns_that_defaulting_to_pandas():
# Operation against self for sanity check
getattr(modin_df_multi_level, op)(modin_df_multi_level, level=1)
getattr(modin_df_multi_level, op)(modin_df_multi_level, level=1)
except TypeError:
# Some operations don't support multilevel `level` parameter
# Operation doesn't support 'level' parameter
pass
else:
# Operation supports 'level' parameter, so it makes sense to check for a warning
with warns_that_defaulting_to_pandas():
getattr(modin_df_multi_level, op)(modin_df_multi_level, level=1)


def create_test_series(vals, sort=False, **kwargs):
Expand Down

0 comments on commit abafbda

Please sign in to comment.