Skip to content

Commit

Permalink
fixup post merge
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli committed May 18, 2021
1 parent 488c56d commit 66f3ec8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -6301,7 +6301,7 @@ def sort_values( # type: ignore[override]
else:
return result.__finalize__(self, method="sort_values")

@deprecate_nonkeyword_arguments(version="2.0", allowed_args=["self"])
@deprecate_nonkeyword_arguments(version=None, allowed_args=["self"])
def sort_index(
self,
axis: Axis = 0,
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -3435,7 +3435,7 @@ def sort_values(
else:
return result.__finalize__(self, method="sort_values")

@deprecate_nonkeyword_arguments(version="2.0", allowed_args=["self"])
@deprecate_nonkeyword_arguments(version=None, allowed_args=["self"])
def sort_index(
self,
axis=0,
Expand Down
8 changes: 5 additions & 3 deletions pandas/tests/frame/methods/test_sort_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -872,8 +872,10 @@ def test_sort_index_pos_args_deprecation(self):
# https://github.com/pandas-dev/pandas/issues/41485
df = DataFrame({"a": [1, 2, 3]})
msg = (
r"Starting with Pandas version 2\.0 all arguments of sort_index "
r"except for the argument 'self' will be keyword-only"
r"In a future version of pandas all arguments of DataFrame.sort_index "
r"will be keyword-only"
)
with tm.assert_produces_warning(FutureWarning, match=msg):
df.sort_index(1)
result = df.sort_index(1)
expected = DataFrame({"a": [1, 2, 3]})
tm.assert_frame_equal(result, expected)
8 changes: 5 additions & 3 deletions pandas/tests/series/methods/test_sort_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,10 @@ def test_sort_index_pos_args_deprecation(self):
# https://github.com/pandas-dev/pandas/issues/41485
ser = Series([1, 2, 3])
msg = (
r"Starting with Pandas version 2\.0 all arguments of sort_index "
r"except for the argument 'self' will be keyword-only"
r"In a future version of pandas all arguments of Series.sort_index "
r"will be keyword-only"
)
with tm.assert_produces_warning(FutureWarning, match=msg):
ser.sort_index(0)
result = ser.sort_index(0)
expected = Series([1, 2, 3])
tm.assert_series_equal(result, expected)

0 comments on commit 66f3ec8

Please sign in to comment.