Skip to content

Commit 42a6fd6

Browse files
dcreekpPingviinituutti
authored andcommitted
TST: clean up to change setup.cfg to xfail_strict = True (GH23057) (pandas-dev#23721)
1 parent aeb5757 commit 42a6fd6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+80
-102
lines changed

pandas/tests/arithmetic/conftest.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def box(request):
154154
@pytest.fixture(params=[pd.Index,
155155
pd.Series,
156156
pytest.param(pd.DataFrame,
157-
marks=pytest.mark.xfail(strict=True))],
157+
marks=pytest.mark.xfail)],
158158
ids=id_func)
159159
def box_df_fail(request):
160160
"""
@@ -167,7 +167,7 @@ def box_df_fail(request):
167167
(pd.Series, False),
168168
(pd.DataFrame, False),
169169
pytest.param((pd.DataFrame, True),
170-
marks=pytest.mark.xfail(strict=True))],
170+
marks=pytest.mark.xfail)],
171171
ids=id_func)
172172
def box_transpose_fail(request):
173173
"""

pandas/tests/arithmetic/test_numeric.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ class TestMultiplicationDivision(object):
407407
pytest.param(pd.Index,
408408
marks=pytest.mark.xfail(reason="Index.__div__ always "
409409
"raises",
410-
raises=TypeError, strict=True)),
410+
raises=TypeError)),
411411
pd.Series,
412412
pd.DataFrame
413413
], ids=lambda x: x.__name__)

pandas/tests/arithmetic/test_object.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def test_add_extension_scalar(self, other, box, op):
9292
@pytest.mark.parametrize('box', [
9393
pytest.param(pd.Index,
9494
marks=pytest.mark.xfail(reason="Does not mask nulls",
95-
strict=True, raises=TypeError)),
95+
raises=TypeError)),
9696
pd.Series,
9797
pd.DataFrame
9898
], ids=lambda x: x.__name__)
@@ -109,7 +109,7 @@ def test_objarr_add_str(self, box):
109109
@pytest.mark.parametrize('box', [
110110
pytest.param(pd.Index,
111111
marks=pytest.mark.xfail(reason="Does not mask nulls",
112-
strict=True, raises=TypeError)),
112+
raises=TypeError)),
113113
pd.Series,
114114
pd.DataFrame
115115
], ids=lambda x: x.__name__)

pandas/tests/arrays/categorical/test_constructors.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,7 @@ def test_construction_with_ordered(self):
538538
cat = Categorical([0, 1, 2], ordered=True)
539539
assert cat.ordered
540540

541-
@pytest.mark.xfail(reason="Imaginary values not supported in Categorical",
542-
strict=True)
541+
@pytest.mark.xfail(reason="Imaginary values not supported in Categorical")
543542
def test_constructor_imaginary(self):
544543
values = [1, 2, 3 + 1j]
545544
c1 = Categorical(values)

pandas/tests/arrays/sparse/test_array.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ def test_astype_all(self, any_real_dtype):
488488
SparseArray(np.array([0, 1], dtype='datetime64[ns]'),
489489
dtype=SparseDtype('datetime64[ns]',
490490
pd.Timestamp('1970'))),
491-
marks=[pytest.mark.xfail(reason="NumPy-7619", strict=True)],
491+
marks=[pytest.mark.xfail(reason="NumPy-7619")],
492492
),
493493
(SparseArray([0, 1, 10]), str,
494494
SparseArray(['0', '1', '10'], dtype=SparseDtype(str, '0'))),

pandas/tests/extension/base/ops.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ def test_arith_series_with_scalar(self, data, all_arithmetic_operators):
7272
s = pd.Series(data)
7373
self.check_opname(s, op_name, s.iloc[0], exc=self.series_scalar_exc)
7474

75-
@pytest.mark.xfail(run=False, reason="_reduce needs implementation",
76-
strict=True)
75+
@pytest.mark.xfail(run=False, reason="_reduce needs implementation")
7776
def test_arith_frame_with_scalar(self, data, all_arithmetic_operators):
7877
# frame & scalar
7978
op_name = all_arithmetic_operators

pandas/tests/extension/base/setitem.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,7 @@ def test_setitem_frame_invalid_length(self, data):
166166
with pytest.raises(ValueError, match=xpr):
167167
df['B'] = data[:5]
168168

169-
@pytest.mark.xfail(reason="GH#20441: setitem on extension types.",
170-
strict=True)
169+
@pytest.mark.xfail(reason="GH#20441: setitem on extension types.")
171170
def test_setitem_tuple_index(self, data):
172171
s = pd.Series(data[:2], index=[(0, 0), (0, 1)])
173172
expected = pd.Series(data.take([1, 1]), index=s.index)

pandas/tests/extension/json/test_json.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def test_stack(self):
148148
rows since we consider `{}` NA, but `.astype(object)` doesn't.
149149
"""
150150

151-
@pytest.mark.xfail(reason="dict for NA", strict=True)
151+
@pytest.mark.xfail(reason="dict for NA")
152152
def test_unstack(self, data, index):
153153
# The base test has NaN for the expected NA value.
154154
# this matches otherwise

pandas/tests/extension/test_categorical.py

+10-11
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class TestDtype(base.BaseDtypeTests):
7272

7373

7474
class TestInterface(base.BaseInterfaceTests):
75-
@pytest.mark.skip(reason="Memory usage doesn't match", strict=True)
75+
@pytest.mark.skip(reason="Memory usage doesn't match")
7676
def test_memory_usage(self, data):
7777
# Is this deliberate?
7878
super(TestInterface, self).test_memory_usage(data)
@@ -87,9 +87,9 @@ class TestReshaping(base.BaseReshapingTests):
8787

8888

8989
class TestGetitem(base.BaseGetitemTests):
90-
skip_take = pytest.mark.skip(reason="GH-20664.", strict=True)
90+
skip_take = pytest.mark.skip(reason="GH-20664.")
9191

92-
@pytest.mark.skip(reason="Backwards compatibility", strict=True)
92+
@pytest.mark.skip(reason="Backwards compatibility")
9393
def test_getitem_scalar(self, data):
9494
# CategoricalDtype.type isn't "correct" since it should
9595
# be a parent of the elements (object). But don't want
@@ -117,20 +117,19 @@ def test_take_non_na_fill_value(self, data_missing):
117117
def test_take_out_of_bounds_raises(self, data, allow_fill):
118118
return super().test_take_out_of_bounds_raises(data, allow_fill)
119119

120-
@pytest.mark.skip(reason="GH-20747. Unobserved categories.", strict=True)
120+
@pytest.mark.skip(reason="GH-20747. Unobserved categories.")
121121
def test_take_series(self, data):
122122
super().test_take_series(data)
123123

124124
@skip_take
125125
def test_reindex_non_na_fill_value(self, data_missing):
126126
super().test_reindex_non_na_fill_value(data_missing)
127127

128-
@pytest.mark.skip(reason="Categorical.take buggy", strict=True)
128+
@pytest.mark.skip(reason="Categorical.take buggy")
129129
def test_take_empty(self, data, na_value, na_cmp):
130130
super().test_take_empty(data, na_value, na_cmp)
131131

132-
@pytest.mark.skip(reason="test not written correctly for categorical",
133-
strict=True)
132+
@pytest.mark.skip(reason="test not written correctly for categorical")
134133
def test_reindex(self, data, na_value):
135134
super().test_reindex(data, na_value)
136135

@@ -141,11 +140,11 @@ class TestSetitem(base.BaseSetitemTests):
141140

142141
class TestMissing(base.BaseMissingTests):
143142

144-
@pytest.mark.skip(reason="Not implemented", strict=True)
143+
@pytest.mark.skip(reason="Not implemented")
145144
def test_fillna_limit_pad(self, data_missing):
146145
super().test_fillna_limit_pad(data_missing)
147146

148-
@pytest.mark.skip(reason="Not implemented", strict=True)
147+
@pytest.mark.skip(reason="Not implemented")
149148
def test_fillna_limit_backfill(self, data_missing):
150149
super().test_fillna_limit_backfill(data_missing)
151150

@@ -155,7 +154,7 @@ class TestReduce(base.BaseNoReduceTests):
155154

156155

157156
class TestMethods(base.BaseMethodsTests):
158-
@pytest.mark.skip(reason="Unobserved categories included", strict=True)
157+
@pytest.mark.skip(reason="Unobserved categories included")
159158
def test_value_counts(self, all_data, dropna):
160159
return super().test_value_counts(all_data, dropna)
161160

@@ -175,7 +174,7 @@ def test_combine_add(self, data_repeated):
175174
expected = pd.Series([a + val for a in list(orig_data1)])
176175
self.assert_series_equal(result, expected)
177176

178-
@pytest.mark.skip(reason="Not Applicable", strict=True)
177+
@pytest.mark.skip(reason="Not Applicable")
179178
def test_fillna_length_mismatch(self, data_missing):
180179
super().test_fillna_length_mismatch(data_missing)
181180

pandas/tests/frame/test_combine_concat.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ def test_concat_multiple_tzs(self):
7777
[
7878
'2015-01-01',
7979
pytest.param(pd.NaT, marks=pytest.mark.xfail(
80-
reason='GH23037 incorrect dtype when concatenating',
81-
strict=True))])
80+
reason='GH23037 incorrect dtype when concatenating'))])
8281
def test_concat_tz_NaT(self, t1):
8382
# GH 22796
8483
# Concating tz-aware multicolumn DataFrames

pandas/tests/frame/test_duplicates.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ def test_duplicated_keep(keep, expected):
5555
tm.assert_series_equal(result, expected)
5656

5757

58-
@pytest.mark.xfail(reason="GH#21720; nan/None falsely considered equal",
59-
strict=True)
58+
@pytest.mark.xfail(reason="GH#21720; nan/None falsely considered equal")
6059
@pytest.mark.parametrize('keep, expected', [
6160
('first', Series([False, False, True, False, True])),
6261
('last', Series([True, True, False, False, False])),

pandas/tests/groupby/test_apply.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ def test_apply_trivial():
6060

6161
@pytest.mark.xfail(reason="GH#20066; function passed into apply "
6262
"returns a DataFrame with the same index "
63-
"as the one to create GroupBy object.",
64-
strict=True)
63+
"as the one to create GroupBy object.")
6564
def test_apply_trivial_fail():
6665
# GH 20066
6766
# trivial apply fails if the constant dataframe has the same index

pandas/tests/groupby/test_categorical.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def test_level_get_group(observed):
206206
assert_frame_equal(result, expected)
207207

208208

209-
@pytest.mark.xfail(PY37, reason="flaky on 3.7, xref gh-21636")
209+
@pytest.mark.xfail(PY37, reason="flaky on 3.7, xref gh-21636", strict=False)
210210
@pytest.mark.parametrize('ordered', [True, False])
211211
def test_apply(ordered):
212212
# GH 10138

pandas/tests/indexes/interval/test_astype.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def test_subtype_integer(self, subtype_start, subtype_end):
9292
closed=index.closed)
9393
tm.assert_index_equal(result, expected)
9494

95-
@pytest.mark.xfail(reason='GH#15832', strict=True)
95+
@pytest.mark.xfail(reason='GH#15832')
9696
def test_subtype_integer_errors(self):
9797
# int64 -> uint64 fails with negative values
9898
index = interval_range(-10, 10)
@@ -130,7 +130,7 @@ def test_subtype_integer(self, subtype):
130130
with pytest.raises(ValueError, match=msg):
131131
index.insert(0, np.nan).astype(dtype)
132132

133-
@pytest.mark.xfail(reason='GH#15832', strict=True)
133+
@pytest.mark.xfail(reason='GH#15832')
134134
def test_subtype_integer_errors(self):
135135
# float64 -> uint64 fails with negative values
136136
index = interval_range(-10.0, 10.0)

pandas/tests/indexes/multi/test_missing.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def test_nulls(idx):
8484
idx.isna()
8585

8686

87-
@pytest.mark.xfail(strict=True)
87+
@pytest.mark.xfail
8888
def test_hasnans_isnans(idx):
8989
# GH 11343, added tests for hasnans / isnans
9090
index = idx.copy()

pandas/tests/indexes/test_base.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,7 @@ def test_constructor_overflow_int64(self):
462462
Index([np.iinfo(np.uint64).max - 1], dtype="int64")
463463

464464
@pytest.mark.xfail(reason="see GH#21311: Index "
465-
"doesn't enforce dtype argument",
466-
strict=True)
465+
"doesn't enforce dtype argument")
467466
def test_constructor_cast(self):
468467
msg = "could not convert string to float"
469468
with pytest.raises(ValueError, match=msg):
@@ -1471,8 +1470,7 @@ def test_slice_float_locs(self):
14711470
assert index2.slice_locs(8.5, 1.5) == (2, 6)
14721471
assert index2.slice_locs(10.5, -1) == (0, n)
14731472

1474-
@pytest.mark.xfail(reason="Assertions were not correct - see GH#20915",
1475-
strict=True)
1473+
@pytest.mark.xfail(reason="Assertions were not correct - see GH#20915")
14761474
def test_slice_ints_with_floats_raises(self):
14771475
# int slicing with floats
14781476
# GH 4892, these are all TypeErrors

pandas/tests/indexing/test_coercion.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -903,11 +903,12 @@ def test_replace_series_datetime_tz(self):
903903

904904
# TODO(jreback) commented out to only have a single xfail printed
905905
@pytest.mark.xfail(reason="different tz, "
906-
"currently mask_missing raises SystemError")
906+
"currently mask_missing raises SystemError",
907+
strict=False)
907908
# @pytest.mark.parametrize('how', ['dict', 'series'])
908909
# @pytest.mark.parametrize('to_key', [
909-
# 'datetime64[ns]', 'datetime64[ns, UTC]',
910-
# 'datetime64[ns, US/Eastern]'])
910+
# 'datetime64[ns]', 'datetime64[ns, UTC]',
911+
# 'datetime64[ns, US/Eastern]'])
911912
# @pytest.mark.parametrize('from_key', [
912913
# 'datetime64[ns]', 'datetime64[ns, UTC]',
913914
# 'datetime64[ns, US/Eastern]'])

pandas/tests/io/formats/test_to_csv.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ def test_to_csv_string_array_ascii(self):
358358
with open(path, 'r') as f:
359359
assert f.read() == expected_ascii
360360

361-
@pytest.mark.xfail(strict=True)
361+
@pytest.mark.xfail
362362
def test_to_csv_string_array_utf8(self):
363363
# GH 10813
364364
str_array = [{'names': ['foo', 'bar']}, {'names': ['baz', 'qux']}]

pandas/tests/io/formats/test_to_html.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def test_to_html_truncate_multi_index(self, datapath):
220220
expected = expected_html(datapath, 'truncate_multi_index')
221221
assert result == expected
222222

223-
@pytest.mark.xfail(reason='GH22887 TypeError', strict=True)
223+
@pytest.mark.xfail(reason='GH22887 TypeError')
224224
def test_to_html_truncate_multi_index_sparse_off(self, datapath):
225225
arrays = [['bar', 'bar', 'baz', 'baz', 'foo', 'foo', 'qux', 'qux'],
226226
['one', 'two', 'one', 'two', 'one', 'two', 'one', 'two']]

pandas/tests/io/json/test_json_table_schema.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ class TestTableOrientReader(object):
498498
None,
499499
"idx",
500500
pytest.param("index",
501-
marks=pytest.mark.xfail(strict=True)),
501+
marks=pytest.mark.xfail),
502502
'level_0'])
503503
@pytest.mark.parametrize("vals", [
504504
{'ints': [1, 2, 3, 4]},
@@ -508,7 +508,7 @@ class TestTableOrientReader(object):
508508
{'ordered_cats': pd.Series(pd.Categorical(['a', 'b', 'c', 'c'],
509509
ordered=True))},
510510
pytest.param({'floats': [1., 2., 3., 4.]},
511-
marks=pytest.mark.xfail(strict=True)),
511+
marks=pytest.mark.xfail),
512512
{'floats': [1.1, 2.2, 3.3, 4.4]},
513513
{'bools': [True, False, False, True]}])
514514
def test_read_json_table_orient(self, index_nm, vals, recwarn):
@@ -566,7 +566,7 @@ def test_multiindex(self, index_names):
566566
tm.assert_frame_equal(df, result)
567567

568568
@pytest.mark.parametrize("strict_check", [
569-
pytest.param(True, marks=pytest.mark.xfail(strict=True)),
569+
pytest.param(True, marks=pytest.mark.xfail),
570570
False
571571
])
572572
def test_empty_frame_roundtrip(self, strict_check):

pandas/tests/io/parser/test_usecols.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,9 @@ def test_raises_on_usecols_names_mismatch(all_parsers, usecols,
520520
tm.assert_frame_equal(result, expected)
521521

522522

523-
@pytest.mark.xfail(reason="see gh-16469: buggy behavior")
523+
@pytest.mark.xfail(
524+
reason="see gh-16469: works on the C engine but not the Python engine",
525+
strict=False)
524526
@pytest.mark.parametrize("usecols", [["A", "C"], [0, 2]])
525527
def test_usecols_subset_names_mismatch_orig_columns(all_parsers, usecols):
526528
data = "a,b,c,d\n1,2,3,4\n5,6,7,8"

pandas/tests/io/test_excel.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -2389,8 +2389,7 @@ def check_called(func):
23892389
pytest.param('xlwt',
23902390
marks=pytest.mark.xfail(reason='xlwt does not support '
23912391
'openpyxl-compatible '
2392-
'style dicts',
2393-
strict=True)),
2392+
'style dicts')),
23942393
'xlsxwriter',
23952394
'openpyxl',
23962395
])

pandas/tests/io/test_parquet.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,7 @@ def test_options_get_engine(fp, pa):
201201

202202

203203
@pytest.mark.xfail(is_platform_windows() or is_platform_mac(),
204-
reason="reading pa metadata failing on Windows/mac",
205-
strict=True)
204+
reason="reading pa metadata failing on Windows/mac")
206205
def test_cross_engine_pa_fp(df_cross_compat, pa, fp):
207206
# cross-compat with differing reading/writing engines
208207

@@ -404,7 +403,8 @@ def test_basic(self, pa, df_full):
404403
check_round_trip(df, pa)
405404

406405
# TODO: This doesn't fail on all systems; track down which
407-
@pytest.mark.xfail(reason="pyarrow fails on this (ARROW-1883)")
406+
@pytest.mark.xfail(reason="pyarrow fails on this (ARROW-1883)",
407+
strict=False)
408408
def test_basic_subset_columns(self, pa, df_full):
409409
# GH18628
410410

@@ -422,7 +422,6 @@ def test_duplicate_columns(self, pa):
422422
columns=list('aaa')).copy()
423423
self.check_error_on_write(df, pa, ValueError)
424424

425-
@pytest.mark.xfail(reason="failing for pyarrow < 0.11.0")
426425
def test_unsupported(self, pa):
427426
# period
428427
df = pd.DataFrame({'a': pd.period_range('2013', freq='M', periods=3)})

pandas/tests/plotting/test_datetimelike.py

+1
Original file line numberDiff line numberDiff line change
@@ -1075,6 +1075,7 @@ def test_irreg_dtypes(self):
10751075
_, ax = self.plt.subplots()
10761076
_check_plot_works(df.plot, ax=ax)
10771077

1078+
@pytest.mark.xfail(reason="fails with py2.7.15", strict=False)
10781079
@pytest.mark.slow
10791080
def test_time(self):
10801081
t = datetime(1, 1, 1, 3, 30, 0)

pandas/tests/plotting/test_frame.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -488,8 +488,7 @@ def test_subplots_timeseries_y_axis(self):
488488
testdata.plot(y="text")
489489

490490
@pytest.mark.xfail(reason='not support for period, categorical, '
491-
'datetime_mixed_tz',
492-
strict=True)
491+
'datetime_mixed_tz')
493492
def test_subplots_timeseries_y_axis_not_supported(self):
494493
"""
495494
This test will fail for:
@@ -2557,6 +2556,7 @@ def test_errorbar_asymmetrical(self):
25572556

25582557
tm.close()
25592558

2559+
# This XPASSES when tested with mpl == 3.0.1
25602560
@td.xfail_if_mpl_2_2
25612561
def test_table(self):
25622562
df = DataFrame(np.random.rand(10, 3),

pandas/tests/plotting/test_misc.py

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ def test_bootstrap_plot(self):
6161
@td.skip_if_no_mpl
6262
class TestDataFramePlots(TestPlotBase):
6363

64+
# This XPASSES when tested with mpl == 3.0.1
6465
@td.xfail_if_mpl_2_2
6566
@td.skip_if_no_scipy
6667
def test_scatter_matrix_axis(self):

0 commit comments

Comments
 (0)