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 92e0608 commit af0bf72
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 @@ -6227,7 +6227,7 @@ def f(vals) -> tuple[np.ndarray, int]:
# ----------------------------------------------------------------------
# Sorting
# TODO: Just move the sort_values doc here.
@deprecate_nonkeyword_arguments(version="2.0", allowed_args=["self", "by"])
@deprecate_nonkeyword_arguments(version=None, allowed_args=["self", "by"])
@Substitution(**_shared_doc_kwargs)
@Appender(NDFrame.sort_values.__doc__)
# error: Signature of "sort_values" incompatible with supertype "NDFrame"
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -3225,7 +3225,7 @@ def update(self, other) -> None:
# ----------------------------------------------------------------------
# Reindexing, sorting

@deprecate_nonkeyword_arguments(version="2.0", allowed_args=["self"])
@deprecate_nonkeyword_arguments(version=None, allowed_args=["self"])
def sort_values(
self,
axis=0,
Expand Down
8 changes: 5 additions & 3 deletions pandas/tests/frame/methods/test_sort_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -861,8 +861,10 @@ def test_sort_values_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_values except "
r"for the arguments 'self' and 'by' will be keyword-only"
r"In a future version of pandas all arguments of DataFrame\.sort_values "
r"except for the argument 'by' will be keyword-only"
)
with tm.assert_produces_warning(FutureWarning, match=msg):
df.sort_values("a", 0)
result = df.sort_values("a", 0)
expected = DataFrame({"a": [1, 2, 3]})
tm.assert_frame_equal(result, expected)
8 changes: 5 additions & 3 deletions pandas/tests/series/methods/test_sort_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,13 @@ def test_sort_values_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_values except "
r"for the argument 'self' will be keyword-only"
r"In a future version of pandas all arguments of Series\.sort_values "
r"will be keyword-only"
)
with tm.assert_produces_warning(FutureWarning, match=msg):
ser.sort_values(0)
result = ser.sort_values(0)
expected = Series([1, 2, 3])
tm.assert_series_equal(result, expected)


class TestSeriesSortingKey:
Expand Down

0 comments on commit af0bf72

Please sign in to comment.