Skip to content

CLN: xfails, FIXMEs #44804

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 1 commit into from
Dec 7, 2021
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
3 changes: 1 addition & 2 deletions pandas/_testing/_warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,14 @@ def _assert_caught_no_extra_warnings(
if _is_unexpected_warning(actual_warning, expected_warning):
# GH 44732: Don't make the CI flaky by filtering SSL-related
# ResourceWarning from dependencies
# GH#38630 pytest.filterwarnings does not suppress these.
unclosed_ssl = (
"unclosed transport <asyncio.sslproto._SSLProtocolTransport",
"unclosed <ssl.SSLSocket",
)
if actual_warning.category == ResourceWarning and any(
msg in str(actual_warning.message) for msg in unclosed_ssl
):
# FIXME(GH#38630): kludge because pytest.filterwarnings does not
# suppress these
continue

extra_warnings.append(
Expand Down
2 changes: 2 additions & 0 deletions pandas/core/arraylike.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,12 @@ def reconstruct(result):
return result

if "out" in kwargs:
# e.g. test_multiindex_get_loc
result = dispatch_ufunc_with_out(self, ufunc, method, *inputs, **kwargs)
return reconstruct(result)

if method == "reduce":
# e.g. test.series.test_ufunc.test_reduce
result = dispatch_reduction_ufunc(self, ufunc, method, *inputs, **kwargs)
if result is not NotImplemented:
return result
Expand Down
16 changes: 10 additions & 6 deletions pandas/core/arrays/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -800,10 +800,12 @@ def min(self, *, axis: int | None = None, skipna: bool = True):
if mask.any():
if not skipna:
return self._na_value
return self[~mask].min()
obj = self[~mask]
else:
obj = self

indexer = self.argsort()[0]
return self[indexer]
indexer = obj.argsort()[0]
return obj[indexer]

def max(self, *, axis: int | None = None, skipna: bool = True):
nv.validate_minmax_axis(axis, self.ndim)
Expand All @@ -815,10 +817,12 @@ def max(self, *, axis: int | None = None, skipna: bool = True):
if mask.any():
if not skipna:
return self._na_value
return self[~mask].max()
obj = self[~mask]
else:
obj = self

indexer = self.argsort()[-1]
return self[indexer]
indexer = obj.argsort()[-1]
return obj[indexer]

def fillna(
self: IntervalArrayT, value=None, method=None, limit=None
Expand Down
23 changes: 6 additions & 17 deletions pandas/core/arrays/numpy_.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,23 +137,12 @@ def __array_ufunc__(self, ufunc: np.ufunc, method: str, *inputs, **kwargs):
# The primary modification is not boxing scalar return values
# in PandasArray, since pandas' ExtensionArrays are 1-d.
out = kwargs.get("out", ())
for x in inputs + out:
# Only support operations with instances of _HANDLED_TYPES.
# Use PandasArray instead of type(self) for isinstance to
# allow subclasses that don't override __array_ufunc__ to
# handle PandasArray objects.
if not isinstance(x, self._HANDLED_TYPES + (PandasArray,)):
return NotImplemented

if ufunc not in [np.logical_or, np.bitwise_or, np.bitwise_xor]:
# For binary ops, use our custom dunder methods
# We haven't implemented logical dunder funcs, so exclude these
# to avoid RecursionError
result = ops.maybe_dispatch_ufunc_to_dunder_op(
self, ufunc, method, *inputs, **kwargs
)
if result is not NotImplemented:
return result

result = ops.maybe_dispatch_ufunc_to_dunder_op(
self, ufunc, method, *inputs, **kwargs
)
if result is not NotImplemented:
return result

# Defer to the implementation of the ufunc on unwrapped values.
inputs = tuple(x._ndarray if isinstance(x, PandasArray) else x for x in inputs)
Expand Down
4 changes: 4 additions & 0 deletions pandas/core/indexes/period.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ def __new__(

if data is None and ordinal is None:
# range-based.
if not fields:
# test_pickle_compat_construction
raise cls._scalar_data_error(None)

data, freq2 = PeriodArray._generate_range(None, None, None, freq, fields)
# PeriodArray._generate range does validation that fields is
# empty when really using the range-based constructor.
Expand Down
3 changes: 0 additions & 3 deletions pandas/tests/frame/methods/test_fillna.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import numpy as np
import pytest

import pandas.util._test_decorators as td

from pandas import (
Categorical,
DataFrame,
Expand Down Expand Up @@ -281,7 +279,6 @@ def test_fillna_dtype_conversion_equiv_replace(self, val):
result = df.fillna(val)
tm.assert_frame_equal(result, expected)

@td.skip_array_manager_invalid_test
def test_fillna_datetime_columns(self):
# GH#7095
df = DataFrame(
Expand Down
9 changes: 7 additions & 2 deletions pandas/tests/indexes/datetimelike_/test_equals.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,17 @@ def test_equals2(self):
assert not idx.equals(pd.Series(idx2))

# Check that we dont raise OverflowError on comparisons outside the
# implementation range
# implementation range GH#28532
oob = Index([timedelta(days=10 ** 6)] * 3, dtype=object)
assert not idx.equals(oob)
assert not idx2.equals(oob)

# FIXME: oob.apply(np.timedelta64) incorrectly overflows
oob2 = Index([np.timedelta64(x) for x in oob], dtype=object)
assert (oob == oob2).all()
assert not idx.equals(oob2)
assert not idx2.equals(oob2)

oob3 = oob.map(np.timedelta64)
assert (oob3 == oob).all()
assert not idx.equals(oob3)
assert not idx2.equals(oob3)
4 changes: 1 addition & 3 deletions pandas/tests/indexes/multi/test_setops.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,7 @@ def test_union_sort_other_empty(slice_):
# default, sort=None
other = idx[slice_]
tm.assert_index_equal(idx.union(other), idx)
# MultiIndex does not special case empty.union(idx)
# FIXME: don't leave commented-out
# tm.assert_index_equal(other.union(idx), idx)
tm.assert_index_equal(other.union(idx), idx)

# sort=False
tm.assert_index_equal(idx.union(other, sort=False), idx)
Expand Down
4 changes: 0 additions & 4 deletions pandas/tests/indexes/period/test_period.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ def simple_index(self) -> Index:
def index(self, request):
return request.param

@pytest.mark.xfail(reason="Goes through a generate_range path")
def test_pickle_compat_construction(self):
super().test_pickle_compat_construction()

def test_where(self):
# This is handled in test_indexing
pass
Expand Down
17 changes: 10 additions & 7 deletions pandas/tests/indexes/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -816,14 +816,17 @@ def test_isin_nan_common_object(self, request, nulls_fixture, nulls_fixture2):
)

def test_isin_nan_common_float64(self, request, nulls_fixture):
if nulls_fixture is pd.NaT:
pytest.skip("pd.NaT not compatible with Float64Index")

# Float64Index overrides isin, so must be checked separately
if nulls_fixture is pd.NA:
request.node.add_marker(
pytest.mark.xfail(reason="Float64Index cannot contain pd.NA")
)
if nulls_fixture is pd.NaT or nulls_fixture is pd.NA:
# Check 1) that we cannot construct a Float64Index with this value
# and 2) that with an NaN we do not have .isin(nulls_fixture)
msg = "data is not compatible with Float64Index"
with pytest.raises(ValueError, match=msg):
Float64Index([1.0, nulls_fixture])

idx = Float64Index([1.0, np.nan])
assert not idx.isin([nulls_fixture]).any()
return

idx = Float64Index([1.0, nulls_fixture])
res = idx.isin([np.nan])
Expand Down
22 changes: 3 additions & 19 deletions pandas/tests/io/parser/common/test_chunksize.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def test_chunks_have_consistent_numerical_type(all_parsers):
assert result.a.dtype == float


def test_warn_if_chunks_have_mismatched_type(all_parsers, request):
def test_warn_if_chunks_have_mismatched_type(all_parsers):
warning_type = None
parser = all_parsers
size = 10000
Expand All @@ -193,24 +193,8 @@ def test_warn_if_chunks_have_mismatched_type(all_parsers, request):

buf = StringIO(data)

try:
with tm.assert_produces_warning(warning_type):
df = parser.read_csv(buf)
except AssertionError as err:
# 2021-02-21 this occasionally fails on the CI with an unexpected
# ResourceWarning that we have been unable to track down,
# see GH#38630
if "ResourceWarning" not in str(err) or parser.engine != "python":
raise

# Check the main assertion of the test before re-raising
assert df.a.dtype == object

mark = pytest.mark.xfail(
reason="ResourceWarning for unclosed SSL Socket, GH#38630"
)
request.node.add_marker(mark)
raise
with tm.assert_produces_warning(warning_type):
df = parser.read_csv(buf)

assert df.a.dtype == object

Expand Down
4 changes: 4 additions & 0 deletions pandas/tests/io/test_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,10 @@ def test_displayed_only(self, displayed_only, exp0, exp1):
else:
assert len(dfs) == 1 # Should not parse hidden table

@pytest.mark.filterwarnings(
"ignore:You provided Unicode markup but also provided a value for "
"from_encoding.*:UserWarning"
)
def test_encode(self, html_encoding_file):
base_path = os.path.basename(html_encoding_file)
root = os.path.splitext(base_path)[0]
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/plotting/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ def test_custom_business_day_freq(self):

_check_plot_works(s.plot)

@pytest.mark.xfail(reason="TODO: reason?")
@pytest.mark.xfail(reason="GH#24426")
def test_plot_accessor_updates_on_inplace(self):
ser = Series([1, 2, 3, 4])
_, ax = self.plt.subplots()
Expand Down
5 changes: 0 additions & 5 deletions pandas/tests/series/indexing/test_setitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,11 +658,6 @@ def test_index_where(self, obj, key, expected, val, request):
mask = np.zeros(obj.shape, dtype=bool)
mask[key] = True

if obj.dtype == bool:
msg = "Index/Series casting behavior inconsistent GH#38692"
mark = pytest.mark.xfail(reason=msg)
request.node.add_marker(mark)

res = Index(obj).where(~mask, val)
tm.assert_index_equal(res, Index(expected))

Expand Down