Skip to content

TST: Address misc test warnings #48207

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 4 commits into from
Aug 25, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions pandas/tests/extension/test_floating.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,5 +211,6 @@ class TestParsing(base.BaseParsingTests):
pass


@pytest.mark.filterwarnings("ignore:overflow encountered in reduce:RuntimeWarning")
class Test2DCompat(base.Dim2CompatTests):
pass
25 changes: 20 additions & 5 deletions pandas/tests/frame/methods/test_combine_first.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import numpy as np
import pytest

from pandas.compat import pa_version_under7p0
from pandas.errors import PerformanceWarning

from pandas.core.dtypes.cast import (
find_common_type,
is_dtype_equal,
Expand Down Expand Up @@ -387,12 +390,24 @@ def test_combine_first_string_dtype_only_na(self, nullable_string_dtype):
{"a": ["962", "85"], "b": [pd.NA] * 2}, dtype=nullable_string_dtype
)
df2 = DataFrame({"a": ["85"], "b": [pd.NA]}, dtype=nullable_string_dtype)
df = df.set_index(["a", "b"], copy=False)
df2 = df2.set_index(["a", "b"], copy=False)
with tm.maybe_produces_warning(
PerformanceWarning,
pa_version_under7p0 and nullable_string_dtype == "string[pyarrow]",
):
df = df.set_index(["a", "b"], copy=False)
with tm.maybe_produces_warning(
PerformanceWarning,
pa_version_under7p0 and nullable_string_dtype == "string[pyarrow]",
):
df2 = df2.set_index(["a", "b"], copy=False)
result = df.combine_first(df2)
expected = DataFrame(
{"a": ["962", "85"], "b": [pd.NA] * 2}, dtype=nullable_string_dtype
).set_index(["a", "b"])
with tm.maybe_produces_warning(
PerformanceWarning,
pa_version_under7p0 and nullable_string_dtype == "string[pyarrow]",
):
expected = DataFrame(
{"a": ["962", "85"], "b": [pd.NA] * 2}, dtype=nullable_string_dtype
).set_index(["a", "b"])
tm.assert_frame_equal(result, expected)


Expand Down
3 changes: 3 additions & 0 deletions pandas/tests/frame/methods/test_quantile.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,9 @@ def test_quantile_empty_no_rows_ints(self, interp_method):
exp = Series([np.nan, np.nan], index=["a", "b"], name=0.5)
tm.assert_series_equal(res, exp)

@pytest.mark.filterwarnings(
"ignore:The behavior of DatetimeArray._from_sequence:FutureWarning"
)
def test_quantile_empty_no_rows_dt64(self, interp_method):
interpolation, method = interp_method
# datetimes
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/test_expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def testit():

with warnings.catch_warnings():
# array has 0s
msg = "invalid value encountered in true_divide"
msg = "invalid value encountered in divide|true_divide"
warnings.filterwarnings("ignore", msg, RuntimeWarning)
result = expr.evaluate(op, left, left, use_numexpr=True)
expected = expr.evaluate(op, left, left, use_numexpr=False)
Expand Down