Skip to content

Commit 1ec162b

Browse files
author
dcreekp
committed
TST: remove redundant strict=True parameter (GH23057)
1 parent b0f16aa commit 1ec162b

33 files changed

+61
-93
lines changed

pandas/tests/arithmetic/conftest.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def box(request):
162162
@pytest.fixture(params=[pd.Index,
163163
pd.Series,
164164
pytest.param(pd.DataFrame,
165-
marks=pytest.mark.xfail(strict=True))],
165+
marks=pytest.mark.xfail)],
166166
ids=id_func)
167167
def box_df_fail(request):
168168
"""
@@ -175,7 +175,7 @@ def box_df_fail(request):
175175
(pd.Series, False),
176176
(pd.DataFrame, False),
177177
pytest.param((pd.DataFrame, True),
178-
marks=pytest.mark.xfail(strict=True))],
178+
marks=pytest.mark.xfail)],
179179
ids=id_func)
180180
def box_transpose_fail(request):
181181
"""

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/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
@@ -497,8 +497,7 @@ def test_constructor_overflow_int64(self):
497497
Index([np.iinfo(np.uint64).max - 1], dtype="int64")
498498

499499
@pytest.mark.xfail(reason="see GH#21311: Index "
500-
"doesn't enforce dtype argument",
501-
strict=True)
500+
"doesn't enforce dtype argument")
502501
def test_constructor_cast(self):
503502
msg = "could not convert string to float"
504503
with pytest.raises(ValueError, match=msg):
@@ -1547,8 +1546,7 @@ def test_slice_float_locs(self):
15471546
assert index2.slice_locs(8.5, 1.5) == (2, 6)
15481547
assert index2.slice_locs(10.5, -1) == (0, n)
15491548

1550-
@pytest.mark.xfail(reason="Assertions were not correct - see GH#20915",
1551-
strict=True)
1549+
@pytest.mark.xfail(reason="Assertions were not correct - see GH#20915")
15521550
def test_slice_ints_with_floats_raises(self):
15531551
# int slicing with floats
15541552
# GH 4892, these are all TypeErrors

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/test_excel.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -2362,8 +2362,7 @@ def check_called(func):
23622362
pytest.param('xlwt',
23632363
marks=pytest.mark.xfail(reason='xlwt does not support '
23642364
'openpyxl-compatible '
2365-
'style dicts',
2366-
strict=True)),
2365+
'style dicts')),
23672366
'xlsxwriter',
23682367
'openpyxl',
23692368
])

pandas/tests/io/test_parquet.py

+1-2
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

pandas/tests/plotting/test_frame.py

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

491491
@pytest.mark.xfail(reason='not support for period, categorical, '
492-
'datetime_mixed_tz',
493-
strict=True)
492+
'datetime_mixed_tz')
494493
def test_subplots_timeseries_y_axis_not_supported(self):
495494
"""
496495
This test will fail for:

pandas/tests/reshape/test_pivot.py

+4-8
Original file line numberDiff line numberDiff line change
@@ -489,8 +489,7 @@ def test_pivot_with_list_like_values_nans(self, values, method):
489489
tm.assert_frame_equal(result, expected)
490490

491491
@pytest.mark.xfail(reason='MultiIndexed unstack with tuple names fails'
492-
'with KeyError GH#19966',
493-
strict=True)
492+
'with KeyError GH#19966')
494493
@pytest.mark.parametrize('method', [True, False])
495494
def test_pivot_with_multiindex(self, method):
496495
# issue #17160
@@ -616,8 +615,7 @@ def test_margins_dtype(self):
616615
tm.assert_frame_equal(expected, result)
617616

618617
@pytest.mark.xfail(reason='GH#17035 (len of floats is casted back to '
619-
'floats)',
620-
strict=True)
618+
'floats)')
621619
def test_margins_dtype_len(self):
622620
mi_val = list(product(['bar', 'foo'], ['one', 'two'])) + [('All', '')]
623621
mi = MultiIndex.from_tuples(mi_val, names=('A', 'B'))
@@ -1102,8 +1100,7 @@ def test_pivot_table_margins_name_with_aggfunc_list(self):
11021100
tm.assert_frame_equal(table, expected)
11031101

11041102
@pytest.mark.xfail(reason='GH#17035 (np.mean of ints is casted back to '
1105-
'ints)',
1106-
strict=True)
1103+
'ints)')
11071104
def test_categorical_margins(self, observed):
11081105
# GH 10989
11091106
df = pd.DataFrame({'x': np.arange(8),
@@ -1118,8 +1115,7 @@ def test_categorical_margins(self, observed):
11181115
tm.assert_frame_equal(table, expected)
11191116

11201117
@pytest.mark.xfail(reason='GH#17035 (np.mean of ints is casted back to '
1121-
'ints)',
1122-
strict=True)
1118+
'ints)')
11231119
def test_categorical_margins_category(self, observed):
11241120
df = pd.DataFrame({'x': np.arange(8),
11251121
'y': np.arange(8) // 4,

pandas/tests/scalar/period/test_asfreq.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ def test_asfreq_near_zero_weekly(self):
3434
assert week2.asfreq('D', 'S') <= per2
3535

3636
@pytest.mark.xfail(reason='GH#19643 period_helper asfreq functions fail '
37-
'to check for overflows',
38-
strict=True)
37+
'to check for overflows')
3938
def test_to_timestamp_out_of_bounds(self):
4039
# GH#19643, currently gives Timestamp('1754-08-30 22:43:41.128654848')
4140
per = Period('0001-01-01', freq='B')

pandas/tests/series/test_analytics.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2140,7 +2140,7 @@ def test_value_counts_with_nan(self):
21402140
"dtype",
21412141
["int_", "uint", "float_", "unicode_", "timedelta64[h]",
21422142
pytest.param("datetime64[D]",
2143-
marks=pytest.mark.xfail(reason="GH#7996", strict=True))]
2143+
marks=pytest.mark.xfail(reason="GH#7996"))]
21442144
)
21452145
@pytest.mark.parametrize("is_ordered", [True, False])
21462146
def test_drop_duplicates_categorical_non_bool(self, dtype, is_ordered):

0 commit comments

Comments
 (0)