Skip to content

TST: Address/catch more test warnings #48358

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

Merged
merged 5 commits into from
Sep 6, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 1 addition & 3 deletions pandas/io/date_converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ def generic_parser(parse_func, *cols) -> np.ndarray:
"""

warnings.warn(
"""
Use pd.to_datetime instead.
""",
"Use pd.to_datetime instead.",
FutureWarning,
stacklevel=find_stack_level(inspect.currentframe()),
)
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/frame/methods/test_fillna.py
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,6 @@ def test_fillna_nonconsolidated_frame():
],
columns=["i1", "i2", "i3", "f1"],
)
df_nonconsol = df.pivot("i1", "i2")
df_nonconsol = df.pivot(index="i1", columns="i2")
result = df_nonconsol.fillna(0)
assert result.isna().sum().sum() == 0
3 changes: 1 addition & 2 deletions pandas/tests/indexes/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,7 @@ def test_hasnans_isnans(self, index_flat):
def test_sort_values_invalid_na_position(index_with_missing, na_position):
with tm.maybe_produces_warning(
PerformanceWarning,
pa_version_under7p0
and getattr(index_with_missing.dtype, "storage", "") == "pyarrow",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How pa_version_under7p0 was dropped here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah thanks. I was testing something locally and had committed this change by accident.

getattr(index_with_missing.dtype, "storage", "") == "pyarrow",
check_stacklevel=False,
):
with pytest.raises(ValueError, match=f"invalid na_position: {na_position}"):
Expand Down
3 changes: 2 additions & 1 deletion pandas/tests/plotting/frame/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ def test_plot(self):

ax = _check_plot_works(df.plot, use_index=True)
self._check_ticks_props(ax, xrot=0)
_check_plot_works(df.plot, sort_columns=False)
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
_check_plot_works(df.plot, sort_columns=False)
_check_plot_works(df.plot, yticks=[1, 5, 10])
_check_plot_works(df.plot, xticks=[1, 5, 10])
_check_plot_works(df.plot, ylim=(-100, 100), xlim=(-100, 100))
Expand Down