Skip to content

Commit

Permalink
TST: strict xfail (pandas-dev#38960)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhshadrach authored and luckyvs1 committed Jan 20, 2021
1 parent a46b441 commit ecf18b9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion pandas/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ def index_with_missing(request):
Fixture for indices with missing values
"""
if request.param in ["int", "uint", "range", "empty", "repeats"]:
pytest.xfail("missing values not supported")
pytest.skip("missing values not supported")
# GH 35538. Use deep copy to avoid illusive bug on np-dev
# Azure pipeline that writes into indices_dict despite copy
ind = indices_dict[request.param].copy(deep=True)
Expand Down
35 changes: 15 additions & 20 deletions pandas/tests/indexing/test_coercion.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,20 @@ def test_insert_index_float64(self, insert, coerced_val, coerced_dtype):
],
ids=["datetime64", "datetime64tz"],
)
def test_insert_index_datetimes(self, fill_val, exp_dtype):
@pytest.mark.parametrize(
"insert_value",
[pd.Timestamp("2012-01-01"), pd.Timestamp("2012-01-01", tz="Asia/Tokyo"), 1],
)
def test_insert_index_datetimes(self, request, fill_val, exp_dtype, insert_value):
if not hasattr(insert_value, "tz"):
request.node.add_marker(
pytest.mark.xfail(reason="ToDo: must coerce to object")
)
elif fill_val.tz != insert_value.tz:
request.node.add_marker(
pytest.mark.xfail(reason="GH 37605 - require tz equality?")
)

obj = pd.DatetimeIndex(
["2011-01-01", "2011-01-02", "2011-01-03", "2011-01-04"], tz=fill_val.tz
)
Expand All @@ -448,25 +461,7 @@ def test_insert_index_datetimes(self, fill_val, exp_dtype):
)
self._assert_insert_conversion(obj, fill_val, exp, exp_dtype)

if fill_val.tz:
msg = "Cannot compare tz-naive and tz-aware"
with pytest.raises(TypeError, match=msg):
obj.insert(1, pd.Timestamp("2012-01-01"))

msg = "Timezones don't match"
with pytest.raises(ValueError, match=msg):
obj.insert(1, pd.Timestamp("2012-01-01", tz="Asia/Tokyo"))

else:
msg = "Cannot compare tz-naive and tz-aware"
with pytest.raises(TypeError, match=msg):
obj.insert(1, pd.Timestamp("2012-01-01", tz="Asia/Tokyo"))

msg = "value should be a 'Timestamp' or 'NaT'. Got 'int' instead."
with pytest.raises(TypeError, match=msg):
obj.insert(1, 1)

pytest.xfail("ToDo: must coerce to object")
obj.insert(1, insert_value)

def test_insert_index_timedelta64(self):
obj = pd.TimedeltaIndex(["1 day", "2 day", "3 day", "4 day"])
Expand Down
11 changes: 8 additions & 3 deletions pandas/tests/tseries/offsets/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,10 @@ def _get_offset(self, klass, value=1, normalize=False):
klass = klass(value, normalize=normalize)
return klass

def test_apply_out_of_range(self, tz_naive_fixture):
def test_apply_out_of_range(self, request, tz_naive_fixture):
tz = tz_naive_fixture
if self._offset is None:
return
if isinstance(tz, tzlocal) and not IS64:
pytest.xfail(reason="OverflowError inside tzlocal past 2038")

# try to create an out-of-bounds result timestamp; if we can't create
# the offset skip
Expand All @@ -123,6 +121,13 @@ def test_apply_out_of_range(self, tz_naive_fixture):
t = Timestamp("20080101", tz=tz)
result = t + offset
assert isinstance(result, datetime)

if isinstance(tz, tzlocal) and not IS64:
# If we hit OutOfBoundsDatetime on non-64 bit machines
# we'll drop out of the try clause before the next test
request.node.add_marker(
pytest.mark.xfail(reason="OverflowError inside tzlocal past 2038")
)
assert t.tzinfo == result.tzinfo

except OutOfBoundsDatetime:
Expand Down

0 comments on commit ecf18b9

Please sign in to comment.