Skip to content

Commit

Permalink
FIX-modin-project#7054: Update exception message for 'shift' function
Browse files Browse the repository at this point in the history
Signed-off-by: Anatoly Myachev <anatoly.myachev@intel.com>
  • Loading branch information
anmyachev committed Mar 12, 2024
1 parent 4ab68c6 commit c2b611b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion modin/pandas/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1409,7 +1409,9 @@ def shift(
+ f"{type(self).__name__}.shift"
)
if axis == 1:
raise ValueError(f"No axis named {axis} for object type {type(self)}")
raise ValueError(
f"No axis named {axis} for object type {type(self).__name__}"
)
return super(type(self), self).shift(
periods=periods, freq=freq, axis=axis, fill_value=fill_value
)
Expand Down
2 changes: 1 addition & 1 deletion modin/pandas/test/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -3262,11 +3262,11 @@ def test_sum(data, skipna, numeric_only, min_count):

@pytest.mark.parametrize("operation", ["sum", "shift"])
def test_sum_axis_1_except(operation):
# ValueError('No axis named 1 for object type Series')
eval_general(
*create_test_series(test_data["int_data"]),
lambda df, *args, **kwargs: getattr(df, operation)(*args, **kwargs),
axis=1,
raising_exceptions=ValueError("No axis named 1 for object type Series"),
)


Expand Down
2 changes: 1 addition & 1 deletion modin/pandas/test/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ def execute_callable(fn, inplace=False, md_kwargs={}, pd_kwargs={}):
assert not isinstance(
md_e, tuple(raising_exceptions)
), f"not acceptable exception type: {md_e}"
elif raising_exceptions and type(raising_exceptions) is type:
elif raising_exceptions and type(raising_exceptions) is not type:
assert (
type(md_e) is type(raising_exceptions)
and md_e.args == raising_exceptions.args
Expand Down

0 comments on commit c2b611b

Please sign in to comment.