diff --git a/pandas/tests/apply/test_str.py b/pandas/tests/apply/test_str.py index 82997328529cd..f215df4c24206 100644 --- a/pandas/tests/apply/test_str.py +++ b/pandas/tests/apply/test_str.py @@ -55,7 +55,7 @@ def test_with_string_args(datetime_series): @pytest.mark.parametrize("op", ["mean", "median", "std", "var"]) @pytest.mark.parametrize("how", ["agg", "apply"]) -def test_apply_np_reducer(float_frame, op, how): +def test_apply_np_reducer(op, how): # GH 39116 float_frame = DataFrame({"a": [1, 2], "b": [3, 4]}) result = getattr(float_frame, how)(op) diff --git a/pandas/tests/arrays/categorical/common.py b/pandas/tests/arrays/categorical/common.py index 4ef9390656979..86d80c5476195 100644 --- a/pandas/tests/arrays/categorical/common.py +++ b/pandas/tests/arrays/categorical/common.py @@ -2,7 +2,7 @@ class TestCategorical: - def setup_method(self, method): + def setup_method(self): self.factor = Categorical( ["a", "b", "b", "a", "a", "c", "c", "c"], ordered=True ) diff --git a/pandas/tests/arrays/categorical/test_indexing.py b/pandas/tests/arrays/categorical/test_indexing.py index 617d1861fa65a..26366178050cc 100644 --- a/pandas/tests/arrays/categorical/test_indexing.py +++ b/pandas/tests/arrays/categorical/test_indexing.py @@ -370,7 +370,7 @@ def array(self, dtype=None): yield -def test_series_at(non_coercible_categorical): +def test_series_at(): arr = Categorical(["a", "b", "c"]) ser = Series(arr) result = ser.at[0] diff --git a/pandas/tests/arrays/masked/test_arithmetic.py b/pandas/tests/arrays/masked/test_arithmetic.py index 6f6fc957d1303..379c339e0eab8 100644 --- a/pandas/tests/arrays/masked/test_arithmetic.py +++ b/pandas/tests/arrays/masked/test_arithmetic.py @@ -173,7 +173,7 @@ def test_error_len_mismatch(data, all_arithmetic_operators): @pytest.mark.parametrize("op", ["__neg__", "__abs__", "__invert__"]) -def test_unary_op_does_not_propagate_mask(data, op, request): +def test_unary_op_does_not_propagate_mask(data, op): # https://github.com/pandas-dev/pandas/issues/39943 data, _ = data ser = pd.Series(data) diff --git a/pandas/tests/arrays/sparse/test_array.py b/pandas/tests/arrays/sparse/test_array.py index 5874e817477a9..0e734f0c1a1e8 100644 --- a/pandas/tests/arrays/sparse/test_array.py +++ b/pandas/tests/arrays/sparse/test_array.py @@ -17,7 +17,7 @@ class TestSparseArray: - def setup_method(self, method): + def setup_method(self): self.arr_data = np.array([np.nan, np.nan, 1, 2, 3, np.nan, 4, 5, np.nan, 6]) self.arr = SparseArray(self.arr_data) self.zarr = SparseArray([0, 0, 1, 2, 3, 0, 4, 5, 0, 6], fill_value=0) diff --git a/pandas/tests/arrays/string_/test_string.py b/pandas/tests/arrays/string_/test_string.py index afeeee3d02f9d..8b2aea5c2e2e1 100644 --- a/pandas/tests/arrays/string_/test_string.py +++ b/pandas/tests/arrays/string_/test_string.py @@ -554,7 +554,7 @@ def test_to_numpy_na_value(dtype, nulls_fixture): tm.assert_numpy_array_equal(result, expected) -def test_isin(dtype, request, fixed_now_ts): +def test_isin(dtype, fixed_now_ts): s = pd.Series(["a", "b", None], dtype=dtype) result = s.isin(["a", "c"]) diff --git a/pandas/tests/config/test_config.py b/pandas/tests/config/test_config.py index 761c8535e6b4a..cc394bbb23d00 100644 --- a/pandas/tests/config/test_config.py +++ b/pandas/tests/config/test_config.py @@ -18,7 +18,7 @@ def setup_class(cls): cls.do = deepcopy(getattr(cls.cf, "_deprecated_options")) cls.ro = deepcopy(getattr(cls.cf, "_registered_options")) - def setup_method(self, method): + def setup_method(self): setattr(self.cf, "_global_config", {}) setattr(self.cf, "options", self.cf.DictWrapper(self.cf._global_config)) setattr(self.cf, "_deprecated_options", {}) @@ -30,7 +30,7 @@ def setup_method(self, method): # "chained_assignment" option, so re-register it. self.cf.register_option("chained_assignment", "raise") - def teardown_method(self, method): + def teardown_method(self): setattr(self.cf, "_global_config", self.gc) setattr(self.cf, "_deprecated_options", self.do) setattr(self.cf, "_registered_options", self.ro) diff --git a/pandas/tests/dtypes/cast/test_promote.py b/pandas/tests/dtypes/cast/test_promote.py index a514a9ce9b0e4..02bd03f5ea266 100644 --- a/pandas/tests/dtypes/cast/test_promote.py +++ b/pandas/tests/dtypes/cast/test_promote.py @@ -348,7 +348,7 @@ def test_maybe_promote_bytes_with_any(bytes_dtype, any_numpy_dtype_reduced): _check_promote(dtype, fill_value, expected_dtype, exp_val_for_scalar) -def test_maybe_promote_any_with_bytes(any_numpy_dtype_reduced, bytes_dtype): +def test_maybe_promote_any_with_bytes(any_numpy_dtype_reduced): dtype = np.dtype(any_numpy_dtype_reduced) # create array of given dtype @@ -391,9 +391,7 @@ def test_maybe_promote_datetime64_with_any(datetime64_dtype, any_numpy_dtype_red ], ids=["pd.Timestamp", "np.datetime64", "datetime.datetime", "datetime.date"], ) -def test_maybe_promote_any_with_datetime64( - any_numpy_dtype_reduced, datetime64_dtype, fill_value -): +def test_maybe_promote_any_with_datetime64(any_numpy_dtype_reduced, fill_value): dtype = np.dtype(any_numpy_dtype_reduced) # filling datetime with anything but datetime casts to object @@ -465,9 +463,7 @@ def test_maybe_promote_timedelta64_with_any(timedelta64_dtype, any_numpy_dtype_r [pd.Timedelta(days=1), np.timedelta64(24, "h"), datetime.timedelta(1)], ids=["pd.Timedelta", "np.timedelta64", "datetime.timedelta"], ) -def test_maybe_promote_any_with_timedelta64( - any_numpy_dtype_reduced, timedelta64_dtype, fill_value -): +def test_maybe_promote_any_with_timedelta64(any_numpy_dtype_reduced, fill_value): dtype = np.dtype(any_numpy_dtype_reduced) # filling anything but timedelta with timedelta casts to object @@ -496,7 +492,7 @@ def test_maybe_promote_string_with_any(string_dtype, any_numpy_dtype_reduced): _check_promote(dtype, fill_value, expected_dtype, exp_val_for_scalar) -def test_maybe_promote_any_with_string(any_numpy_dtype_reduced, string_dtype): +def test_maybe_promote_any_with_string(any_numpy_dtype_reduced): dtype = np.dtype(any_numpy_dtype_reduced) # create array of given dtype @@ -523,7 +519,7 @@ def test_maybe_promote_object_with_any(object_dtype, any_numpy_dtype_reduced): _check_promote(dtype, fill_value, expected_dtype, exp_val_for_scalar) -def test_maybe_promote_any_with_object(any_numpy_dtype_reduced, object_dtype): +def test_maybe_promote_any_with_object(any_numpy_dtype_reduced): dtype = np.dtype(any_numpy_dtype_reduced) # create array of object dtype from a scalar value (i.e. passing diff --git a/pandas/tests/dtypes/test_dtypes.py b/pandas/tests/dtypes/test_dtypes.py index 30447de874aaa..f077317e7ebbe 100644 --- a/pandas/tests/dtypes/test_dtypes.py +++ b/pandas/tests/dtypes/test_dtypes.py @@ -848,7 +848,7 @@ def test_categories(self): tm.assert_index_equal(result.categories, pd.Index(["a", "b", "c"])) assert result.ordered is False - def test_equal_but_different(self, ordered): + def test_equal_but_different(self): c1 = CategoricalDtype([1, 2, 3]) c2 = CategoricalDtype([1.0, 2.0, 3.0]) assert c1 is not c2 diff --git a/pandas/tests/extension/base/setitem.py b/pandas/tests/extension/base/setitem.py index 7a822bd3c607a..221710fbffca1 100644 --- a/pandas/tests/extension/base/setitem.py +++ b/pandas/tests/extension/base/setitem.py @@ -357,7 +357,7 @@ def test_setitem_series(self, data, full_indexer): ) self.assert_series_equal(result, expected) - def test_setitem_frame_2d_values(self, data, request): + def test_setitem_frame_2d_values(self, data): # GH#44514 df = pd.DataFrame({"A": data}) orig = df.copy() diff --git a/pandas/tests/extension/test_sparse.py b/pandas/tests/extension/test_sparse.py index 4f453986ad2c3..37acbb4e92dfb 100644 --- a/pandas/tests/extension/test_sparse.py +++ b/pandas/tests/extension/test_sparse.py @@ -54,7 +54,7 @@ def data(request): @pytest.fixture -def data_for_twos(request): +def data_for_twos(): return SparseArray(np.ones(100) * 2) diff --git a/pandas/tests/frame/indexing/test_setitem.py b/pandas/tests/frame/indexing/test_setitem.py index c8a22e48d16c1..f1e7b18a73173 100644 --- a/pandas/tests/frame/indexing/test_setitem.py +++ b/pandas/tests/frame/indexing/test_setitem.py @@ -397,7 +397,7 @@ def test_setitem_frame_length_0_str_key(self, indexer): expected["A"] = expected["A"].astype("object") tm.assert_frame_equal(df, expected) - def test_setitem_frame_duplicate_columns(self, using_array_manager, request): + def test_setitem_frame_duplicate_columns(self, using_array_manager): # GH#15695 cols = ["A", "B", "C"] * 2 df = DataFrame(index=range(3), columns=cols) @@ -1099,7 +1099,7 @@ def test_setitem_duplicate_columns_not_inplace(self): @pytest.mark.parametrize( "value", [1, np.array([[1], [1]], dtype="int64"), [[1], [1]]] ) - def test_setitem_same_dtype_not_inplace(self, value, using_array_manager, request): + def test_setitem_same_dtype_not_inplace(self, value, using_array_manager): # GH#39510 cols = ["A", "B"] df = DataFrame(0, index=[0, 1], columns=cols) diff --git a/pandas/tests/frame/methods/test_interpolate.py b/pandas/tests/frame/methods/test_interpolate.py index 37fb0754baffd..6566d426d9a6b 100644 --- a/pandas/tests/frame/methods/test_interpolate.py +++ b/pandas/tests/frame/methods/test_interpolate.py @@ -320,7 +320,7 @@ def test_interp_ignore_all_good(self): result = df[["B", "D"]].interpolate(downcast=None) tm.assert_frame_equal(result, df[["B", "D"]]) - def test_interp_time_inplace_axis(self, axis): + def test_interp_time_inplace_axis(self): # GH 9687 periods = 5 idx = date_range(start="2014-01-01", periods=periods) diff --git a/pandas/tests/frame/methods/test_quantile.py b/pandas/tests/frame/methods/test_quantile.py index 76ef57391a7b3..040b981c41593 100644 --- a/pandas/tests/frame/methods/test_quantile.py +++ b/pandas/tests/frame/methods/test_quantile.py @@ -673,7 +673,7 @@ def test_quantile_ea_with_na(self, obj, index): # TODO(GH#39763): filtering can be removed after GH#39763 is fixed @pytest.mark.filterwarnings("ignore:Using .astype to convert:FutureWarning") - def test_quantile_ea_all_na(self, obj, index, frame_or_series, request): + def test_quantile_ea_all_na(self, obj, index): obj.iloc[:] = index._na_value # TODO(ArrayManager): this casting should be unnecessary after GH#39763 is fixed diff --git a/pandas/tests/frame/methods/test_tz_convert.py b/pandas/tests/frame/methods/test_tz_convert.py index bb9ea64d5f326..c5f6870769afc 100644 --- a/pandas/tests/frame/methods/test_tz_convert.py +++ b/pandas/tests/frame/methods/test_tz_convert.py @@ -104,17 +104,17 @@ def test_tz_convert_and_localize(self, fn): # Not DatetimeIndex / PeriodIndex with pytest.raises(TypeError, match="DatetimeIndex"): df = DataFrame(index=int_idx) - df = getattr(df, fn)("US/Pacific") + getattr(df, fn)("US/Pacific") # Not DatetimeIndex / PeriodIndex with pytest.raises(TypeError, match="DatetimeIndex"): df = DataFrame(np.ones(5), MultiIndex.from_arrays([int_idx, l0])) - df = getattr(df, fn)("US/Pacific", level=0) + getattr(df, fn)("US/Pacific", level=0) # Invalid level with pytest.raises(ValueError, match="not valid"): df = DataFrame(index=l0) - df = getattr(df, fn)("US/Pacific", level=1) + getattr(df, fn)("US/Pacific", level=1) @pytest.mark.parametrize("copy", [True, False]) def test_tz_convert_copy_inplace_mutate(self, copy, frame_or_series): diff --git a/pandas/tests/frame/test_query_eval.py b/pandas/tests/frame/test_query_eval.py index 558ba0424e481..842ff172c34c4 100644 --- a/pandas/tests/frame/test_query_eval.py +++ b/pandas/tests/frame/test_query_eval.py @@ -36,7 +36,7 @@ def skip_if_no_pandas_parser(parser): class TestCompat: - def setup_method(self, method): + def setup_method(self): self.df = DataFrame({"A": [1, 2, 3]}) self.expected1 = self.df[self.df.A > 0] self.expected2 = self.df.A + 1 @@ -1090,10 +1090,10 @@ def test_query_string_scalar_variable(self, parser, engine): class TestDataFrameEvalWithFrame: - def setup_method(self, method): + def setup_method(self): self.frame = DataFrame(np.random.randn(10, 3), columns=list("abc")) - def teardown_method(self, method): + def teardown_method(self): del self.frame def test_simple_expr(self, parser, engine): diff --git a/pandas/tests/frame/test_repr_info.py b/pandas/tests/frame/test_repr_info.py index f19edf5722ca1..765640c94673e 100644 --- a/pandas/tests/frame/test_repr_info.py +++ b/pandas/tests/frame/test_repr_info.py @@ -62,7 +62,7 @@ def test_assign_index_sequences(self): df.index = index repr(df) - def test_repr_with_mi_nat(self, float_string_frame): + def test_repr_with_mi_nat(self): df = DataFrame({"X": [1, 2]}, index=[[NaT, Timestamp("20130101")], ["a", "b"]]) result = repr(df) expected = " X\nNaT a 1\n2013-01-01 b 2" diff --git a/pandas/tests/frame/test_ufunc.py b/pandas/tests/frame/test_ufunc.py index 79e9b1f34978d..2a4b212d0acd7 100644 --- a/pandas/tests/frame/test_ufunc.py +++ b/pandas/tests/frame/test_ufunc.py @@ -81,7 +81,7 @@ def test_binary_input_dispatch_binop(dtype): ), ], ) -def test_ufunc_passes_args(func, arg, expected, request): +def test_ufunc_passes_args(func, arg, expected): # GH#40662 arr = np.array([[1, 2], [3, 4]]) df = pd.DataFrame(arr) diff --git a/pandas/tests/groupby/test_apply.py b/pandas/tests/groupby/test_apply.py index cfc4b8934622f..6c6812a25fcd9 100644 --- a/pandas/tests/groupby/test_apply.py +++ b/pandas/tests/groupby/test_apply.py @@ -241,7 +241,7 @@ def test_apply_with_mixed_dtype(): tm.assert_series_equal(result1, result2) -def test_groupby_as_index_apply(df): +def test_groupby_as_index_apply(): # GH #4648 and #3417 df = DataFrame( { diff --git a/pandas/tests/groupby/test_categorical.py b/pandas/tests/groupby/test_categorical.py index 3d5016b058c07..a33e4efbe3b6d 100644 --- a/pandas/tests/groupby/test_categorical.py +++ b/pandas/tests/groupby/test_categorical.py @@ -1447,7 +1447,7 @@ def test_dataframe_groupby_on_2_categoricals_when_observed_is_true(reduction_fun @pytest.mark.parametrize("observed", [False, None]) def test_dataframe_groupby_on_2_categoricals_when_observed_is_false( - reduction_func, observed, request + reduction_func, observed ): # GH 23865 # GH 27075 diff --git a/pandas/tests/groupby/test_groupby.py b/pandas/tests/groupby/test_groupby.py index 2da835737bad4..e5b794690da92 100644 --- a/pandas/tests/groupby/test_groupby.py +++ b/pandas/tests/groupby/test_groupby.py @@ -821,7 +821,7 @@ def test_groupby_as_index_corner(df, ts): df.groupby(lambda x: x.lower(), as_index=False, axis=1) -def test_groupby_multiple_key(df): +def test_groupby_multiple_key(): df = tm.makeTimeDataFrame() grouped = df.groupby([lambda x: x.year, lambda x: x.month, lambda x: x.day]) agged = grouped.sum() diff --git a/pandas/tests/groupby/test_size.py b/pandas/tests/groupby/test_size.py index f87e4117f57fd..06f79ef609db1 100644 --- a/pandas/tests/groupby/test_size.py +++ b/pandas/tests/groupby/test_size.py @@ -20,7 +20,7 @@ def test_size(df, by): @pytest.mark.parametrize("by", ["A", "B", ["A", "B"]]) @pytest.mark.parametrize("sort", [True, False]) -def test_size_sort(df, sort, by): +def test_size_sort(sort, by): df = DataFrame(np.random.choice(20, (1000, 3)), columns=list("ABC")) left = df.groupby(by=by, sort=sort).size() right = df.groupby(by=by, sort=sort)["C"].apply(lambda a: a.shape[0]) diff --git a/pandas/tests/indexes/categorical/test_category.py b/pandas/tests/indexes/categorical/test_category.py index 2ae6ce99b4ee8..e06388e5d21ec 100644 --- a/pandas/tests/indexes/categorical/test_category.py +++ b/pandas/tests/indexes/categorical/test_category.py @@ -25,7 +25,7 @@ def simple_index(self) -> CategoricalIndex: return self._index_cls(list("aabbca"), categories=list("cab"), ordered=False) @pytest.fixture - def index(self, request): + def index(self): return tm.makeCategoricalIndex(100) def create_index(self, *, categories=None, ordered=False): diff --git a/pandas/tests/indexes/datetimes/test_setops.py b/pandas/tests/indexes/datetimes/test_setops.py index 7c2b3b7f4482d..4558fcccbb0e1 100644 --- a/pandas/tests/indexes/datetimes/test_setops.py +++ b/pandas/tests/indexes/datetimes/test_setops.py @@ -417,7 +417,7 @@ def test_intersection_non_tick_no_fastpath(self): class TestBusinessDatetimeIndex: - def setup_method(self, method): + def setup_method(self): self.rng = bdate_range(START, END) def test_union(self, sort): @@ -555,7 +555,7 @@ def test_intersection_duplicates(self, sort): class TestCustomDatetimeIndex: - def setup_method(self, method): + def setup_method(self): self.rng = bdate_range(START, END, freq="C") def test_union(self, sort): diff --git a/pandas/tests/indexes/multi/test_setops.py b/pandas/tests/indexes/multi/test_setops.py index 9f12d62155692..ea33c1178957e 100644 --- a/pandas/tests/indexes/multi/test_setops.py +++ b/pandas/tests/indexes/multi/test_setops.py @@ -368,7 +368,7 @@ def test_union_sort_other_empty(slice_): @pytest.mark.xfail(reason="Not implemented.") -def test_union_sort_other_empty_sort(slice_): +def test_union_sort_other_empty_sort(): # TODO(GH#25151): decide on True behaviour # # sort=True idx = MultiIndex.from_product([[1, 0], ["a", "b"]]) diff --git a/pandas/tests/indexes/test_base.py b/pandas/tests/indexes/test_base.py index 1145de14ad3c4..51840be14d320 100644 --- a/pandas/tests/indexes/test_base.py +++ b/pandas/tests/indexes/test_base.py @@ -452,7 +452,7 @@ def test_empty_fancy_raises(self, index): with pytest.raises(IndexError, match=msg): index[empty_farr] - def test_union_dt_as_obj(self, sort, simple_index): + def test_union_dt_as_obj(self, simple_index): # TODO: Replace with fixturesult index = simple_index date_index = date_range("2019-01-01", periods=10) @@ -792,7 +792,7 @@ def test_isin(self, values, index, expected): result = index.isin(values) tm.assert_numpy_array_equal(result, expected) - def test_isin_nan_common_object(self, request, nulls_fixture, nulls_fixture2): + def test_isin_nan_common_object(self, nulls_fixture, nulls_fixture2): # Test cartesian product of null fixtures and ensure that we don't # mangle the various types (save a corner case with PyPy) @@ -820,7 +820,7 @@ def test_isin_nan_common_object(self, request, nulls_fixture, nulls_fixture2): np.array([False, False]), ) - def test_isin_nan_common_float64(self, request, nulls_fixture): + def test_isin_nan_common_float64(self, nulls_fixture): if nulls_fixture is pd.NaT or nulls_fixture is pd.NA: # Check 1) that we cannot construct a Float64Index with this value diff --git a/pandas/tests/indexes/test_numpy_compat.py b/pandas/tests/indexes/test_numpy_compat.py index 3ee83160c1106..8f3ecce223afa 100644 --- a/pandas/tests/indexes/test_numpy_compat.py +++ b/pandas/tests/indexes/test_numpy_compat.py @@ -96,7 +96,7 @@ def test_numpy_ufuncs_basic(index, func): @pytest.mark.parametrize( "func", [np.isfinite, np.isinf, np.isnan, np.signbit], ids=lambda x: x.__name__ ) -def test_numpy_ufuncs_other(index, func, request): +def test_numpy_ufuncs_other(index, func): # test ufuncs of numpy, see: # https://numpy.org/doc/stable/reference/ufuncs.html if isinstance(index, (DatetimeIndex, TimedeltaIndex)): diff --git a/pandas/tests/indexes/test_setops.py b/pandas/tests/indexes/test_setops.py index a150a1f6d9494..bad75b7429efb 100644 --- a/pandas/tests/indexes/test_setops.py +++ b/pandas/tests/indexes/test_setops.py @@ -432,7 +432,7 @@ def test_difference_preserves_type_empty(self, index, sort): expected = index[:0] tm.assert_index_equal(result, expected, exact=True) - def test_difference_name_retention_equals(self, index, sort, names): + def test_difference_name_retention_equals(self, index, names): if isinstance(index, MultiIndex): names = [[x] * index.nlevels for x in names] index = index.rename(names[0]) diff --git a/pandas/tests/indexing/common.py b/pandas/tests/indexing/common.py index f8db005583bd8..ea9f2584196d3 100644 --- a/pandas/tests/indexing/common.py +++ b/pandas/tests/indexing/common.py @@ -43,7 +43,7 @@ class Base: "multi", } - def setup_method(self, method): + def setup_method(self): self.series_ints = Series(np.random.rand(4), index=np.arange(0, 8, 2)) self.frame_ints = DataFrame( diff --git a/pandas/tests/indexing/multiindex/test_sorted.py b/pandas/tests/indexing/multiindex/test_sorted.py index b6cdd0e19a94e..2214aaa9cfbdb 100644 --- a/pandas/tests/indexing/multiindex/test_sorted.py +++ b/pandas/tests/indexing/multiindex/test_sorted.py @@ -64,7 +64,7 @@ def test_frame_getitem_not_sorted2(self, key): assert result.index.is_monotonic_increasing tm.assert_frame_equal(result, expected) - def test_sort_values_key(self, multiindex_dataframe_random_data): + def test_sort_values_key(self): arrays = [ ["bar", "bar", "baz", "baz", "qux", "qux", "foo", "foo"], ["one", "two", "one", "two", "one", "two", "one", "two"], diff --git a/pandas/tests/indexing/test_categorical.py b/pandas/tests/indexing/test_categorical.py index 870043897e8e2..eb38edd920082 100644 --- a/pandas/tests/indexing/test_categorical.py +++ b/pandas/tests/indexing/test_categorical.py @@ -21,7 +21,7 @@ class TestCategoricalIndex: - def setup_method(self, method): + def setup_method(self): self.df = DataFrame( { diff --git a/pandas/tests/indexing/test_coercion.py b/pandas/tests/indexing/test_coercion.py index 7705ec9050aed..5ef079270479f 100644 --- a/pandas/tests/indexing/test_coercion.py +++ b/pandas/tests/indexing/test_coercion.py @@ -265,7 +265,7 @@ def test_insert_index_float64(self, insert, coerced_val, coerced_dtype): "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): + def test_insert_index_datetimes(self, fill_val, exp_dtype, insert_value): obj = pd.DatetimeIndex( ["2011-01-01", "2011-01-02", "2011-01-03", "2011-01-04"], tz=fill_val.tz diff --git a/pandas/tests/internals/test_internals.py b/pandas/tests/internals/test_internals.py index 83df57f922c9c..84f4709f291b6 100644 --- a/pandas/tests/internals/test_internals.py +++ b/pandas/tests/internals/test_internals.py @@ -244,7 +244,7 @@ def create_mgr(descr, item_shape=None): class TestBlock: - def setup_method(self, method): + def setup_method(self): self.fblock = create_block("float", [0, 2, 4]) self.cblock = create_block("complex", [7]) self.oblock = create_block("object", [1, 3]) diff --git a/pandas/tests/io/excel/test_openpyxl.py b/pandas/tests/io/excel/test_openpyxl.py index 9f6e1ed9c08d9..7cd58be8a8237 100644 --- a/pandas/tests/io/excel/test_openpyxl.py +++ b/pandas/tests/io/excel/test_openpyxl.py @@ -307,7 +307,7 @@ def test_read_workbook(datapath, ext, read_only): # When read_only is None, use read_excel instead of a workbook @pytest.mark.parametrize("read_only", [True, False, None]) def test_read_with_bad_dimension( - datapath, ext, header, expected_data, filename, read_only, request + datapath, ext, header, expected_data, filename, read_only ): # GH 38956, 39001 - no/incorrect dimension information path = datapath("io", "data", "excel", f"{filename}{ext}") @@ -345,7 +345,7 @@ def test_append_mode_file(ext): # When read_only is None, use read_excel instead of a workbook @pytest.mark.parametrize("read_only", [True, False, None]) -def test_read_with_empty_trailing_rows(datapath, ext, read_only, request): +def test_read_with_empty_trailing_rows(datapath, ext, read_only): # GH 39181 path = datapath("io", "data", "excel", f"empty_trailing_rows{ext}") if read_only is None: diff --git a/pandas/tests/io/excel/test_readers.py b/pandas/tests/io/excel/test_readers.py index 589c98721f139..b52b0fa96ff33 100644 --- a/pandas/tests/io/excel/test_readers.py +++ b/pandas/tests/io/excel/test_readers.py @@ -721,7 +721,7 @@ def test_excel_read_buffer(self, read_ext): actual = pd.read_excel(f, sheet_name="Sheet1", index_col=0) tm.assert_frame_equal(expected, actual) - def test_bad_engine_raises(self, read_ext): + def test_bad_engine_raises(self): bad_engine = "foo" with pytest.raises(ValueError, match="Unknown engine: foo"): pd.read_excel("", engine=bad_engine) @@ -743,7 +743,7 @@ def test_missing_file_raises(self, read_ext): with pytest.raises(FileNotFoundError, match=match): pd.read_excel(bad_file) - def test_corrupt_bytes_raises(self, read_ext, engine): + def test_corrupt_bytes_raises(self, engine): bad_stream = b"foo" if engine is None: error = ValueError @@ -1287,7 +1287,7 @@ def test_ignore_chartsheets_by_int(self, request, engine, read_ext): ): pd.read_excel("chartsheet" + read_ext, sheet_name=1) - def test_euro_decimal_format(self, request, read_ext): + def test_euro_decimal_format(self, read_ext): # copied from read_csv result = pd.read_excel("test_decimal" + read_ext, decimal=",", skiprows=1) expected = DataFrame( @@ -1311,7 +1311,7 @@ def cd_and_set_engine(self, engine, datapath, monkeypatch): monkeypatch.chdir(datapath("io", "data", "excel")) monkeypatch.setattr(pd, "ExcelFile", func) - def test_engine_used(self, read_ext, engine, monkeypatch): + def test_engine_used(self, read_ext, engine): expected_defaults = { "xlsx": "openpyxl", "xlsm": "openpyxl", diff --git a/pandas/tests/io/excel/test_writers.py b/pandas/tests/io/excel/test_writers.py index 6f06ef9c09e52..e2236e5d2f01d 100644 --- a/pandas/tests/io/excel/test_writers.py +++ b/pandas/tests/io/excel/test_writers.py @@ -350,7 +350,7 @@ def test_excel_sheet_size(self, path): with pytest.raises(ValueError, match=msg): col_df.to_excel(path) - def test_excel_sheet_by_name_raise(self, path, engine): + def test_excel_sheet_by_name_raise(self, path): gt = DataFrame(np.random.randn(10, 2)) gt.to_excel(path) @@ -649,7 +649,7 @@ def test_excel_roundtrip_datetime(self, merge_cells, tsframe, path): tm.assert_frame_equal(tsframe, recons) - def test_excel_date_datetime_format(self, engine, ext, path): + def test_excel_date_datetime_format(self, ext, path): # see gh-4133 # # Excel output format strings @@ -866,7 +866,7 @@ def test_to_excel_output_encoding(self, ext): result = pd.read_excel(filename, sheet_name="TestSheet", index_col=0) tm.assert_frame_equal(result, df) - def test_to_excel_unicode_filename(self, ext, path): + def test_to_excel_unicode_filename(self, ext): with tm.ensure_clean("\u0192u." + ext) as filename: try: f = open(filename, "wb") @@ -1189,7 +1189,7 @@ def test_path_local_path(self, engine, ext): result = tm.round_trip_localpath(writer, reader, path=f"foo{ext}") tm.assert_frame_equal(result, df) - def test_merged_cell_custom_objects(self, merge_cells, path): + def test_merged_cell_custom_objects(self, path): # see GH-27006 mi = MultiIndex.from_tuples( [ diff --git a/pandas/tests/io/formats/style/test_html.py b/pandas/tests/io/formats/style/test_html.py index fad289d5e0d2c..2010d06c9d22d 100644 --- a/pandas/tests/io/formats/style/test_html.py +++ b/pandas/tests/io/formats/style/test_html.py @@ -469,7 +469,7 @@ def test_maximums(styler_mi, rows, cols): assert (">2" in result) is not cols # first trimmed horizontal element -def test_replaced_css_class_names(styler_mi): +def test_replaced_css_class_names(): css = { "row_heading": "ROWHEAD", # "col_heading": "COLHEAD", diff --git a/pandas/tests/io/formats/style/test_style.py b/pandas/tests/io/formats/style/test_style.py index 915497e614b3a..1b2d2692eab03 100644 --- a/pandas/tests/io/formats/style/test_style.py +++ b/pandas/tests/io/formats/style/test_style.py @@ -441,7 +441,7 @@ def test_apply_map_header_raises(mi_styler): class TestStyler: - def setup_method(self, method): + def setup_method(self): np.random.seed(24) self.s = DataFrame({"A": np.random.permutation(range(6))}) self.df = DataFrame({"A": [0, 1], "B": np.random.randn(2)}) diff --git a/pandas/tests/io/formats/test_format.py b/pandas/tests/io/formats/test_format.py index 99378654c6c11..adcaeba5cfd8d 100644 --- a/pandas/tests/io/formats/test_format.py +++ b/pandas/tests/io/formats/test_format.py @@ -2111,7 +2111,7 @@ def gen_series_formatting(): class TestSeriesFormatting: - def setup_method(self, method): + def setup_method(self): self.ts = tm.makeTimeSeries() def test_repr_unicode(self): diff --git a/pandas/tests/io/formats/test_to_markdown.py b/pandas/tests/io/formats/test_to_markdown.py index 2bd0d11888163..55ec9c83601f9 100644 --- a/pandas/tests/io/formats/test_to_markdown.py +++ b/pandas/tests/io/formats/test_to_markdown.py @@ -59,7 +59,7 @@ def test_series(): ) -def test_no_buf(capsys): +def test_no_buf(): df = pd.DataFrame([1, 2, 3]) result = df.to_markdown() assert ( diff --git a/pandas/tests/io/json/test_json_table_schema_ext_dtype.py b/pandas/tests/io/json/test_json_table_schema_ext_dtype.py index cd760854cb01e..f6aa16ff0ce38 100644 --- a/pandas/tests/io/json/test_json_table_schema_ext_dtype.py +++ b/pandas/tests/io/json/test_json_table_schema_ext_dtype.py @@ -30,7 +30,7 @@ class TestBuildSchema: - def setup_method(self, method): + def setup_method(self): self.da = DateArray([dt.date(2021, 10, 10)]) self.dc = DecimalArray([decimal.Decimal(10)]) self.sa = array(["pandas"], dtype="string") @@ -117,7 +117,7 @@ def test_as_json_table_type_ext_integer_dtype(self): class TestTableOrient: - def setup_method(self, method): + def setup_method(self): self.da = DateArray([dt.date(2021, 10, 10)]) self.dc = DecimalArray([decimal.Decimal(10)]) self.sa = array(["pandas"], dtype="string") diff --git a/pandas/tests/io/json/test_pandas.py b/pandas/tests/io/json/test_pandas.py index 3717952a2183e..5714ab72bf3f3 100644 --- a/pandas/tests/io/json/test_pandas.py +++ b/pandas/tests/io/json/test_pandas.py @@ -364,7 +364,7 @@ def test_frame_from_json_missing_data(self, orient, convert_axes, numpy, dtype): assert np.isnan(result.iloc[0, 2]) @pytest.mark.parametrize("dtype", [True, False]) - def test_frame_read_json_dtype_missing_value(self, orient, dtype): + def test_frame_read_json_dtype_missing_value(self, dtype): # GH28501 Parse missing values using read_json with dtype=False # to NaN instead of None result = read_json("[null]", dtype=dtype) @@ -374,7 +374,7 @@ def test_frame_read_json_dtype_missing_value(self, orient, dtype): @pytest.mark.parametrize("inf", [np.inf, np.NINF]) @pytest.mark.parametrize("dtype", [True, False]) - def test_frame_infinity(self, orient, inf, dtype): + def test_frame_infinity(self, inf, dtype): # infinities get mapped to nulls which get mapped to NaNs during # deserialisation df = DataFrame([[1, 2], [4, 5, 6]]) diff --git a/pandas/tests/io/parser/dtypes/test_dtypes_basic.py b/pandas/tests/io/parser/dtypes/test_dtypes_basic.py index cdf9c0a1784a4..e0b1b31c9cefc 100644 --- a/pandas/tests/io/parser/dtypes/test_dtypes_basic.py +++ b/pandas/tests/io/parser/dtypes/test_dtypes_basic.py @@ -193,7 +193,7 @@ def test_delimiter_with_usecols_and_parse_dates(all_parsers): @pytest.mark.parametrize("thousands", ["_", None]) def test_decimal_and_exponential(python_parser_only, numeric_decimal, thousands): # GH#31920 - decimal_number_check(python_parser_only, numeric_decimal, thousands, None) + decimal_number_check(python_parser_only, numeric_decimal, thousands) @pytest.mark.parametrize("thousands", ["_", None]) @@ -203,15 +203,15 @@ def test_1000_sep_decimal_float_precision( ): # test decimal and thousand sep handling in across 'float_precision' # parsers - decimal_number_check(c_parser_only, numeric_decimal, thousands, float_precision) + decimal_number_check(c_parser_only, numeric_decimal, thousands) text, value = numeric_decimal text = " " + text + " " if isinstance(value, str): # the negative cases (parse as text) value = " " + value + " " - decimal_number_check(c_parser_only, (text, value), thousands, float_precision) + decimal_number_check(c_parser_only, (text, value), thousands) -def decimal_number_check(parser, numeric_decimal, thousands, float_precision): +def decimal_number_check(parser, numeric_decimal, thousands): # GH#31920 value = numeric_decimal[0] if thousands is None and "_" in value: diff --git a/pandas/tests/io/parser/test_encoding.py b/pandas/tests/io/parser/test_encoding.py index 2b27332c7e85b..a70c3ee44edb6 100644 --- a/pandas/tests/io/parser/test_encoding.py +++ b/pandas/tests/io/parser/test_encoding.py @@ -153,9 +153,7 @@ def test_read_csv_utf_aliases(all_parsers, utf_value, encoding_fmt): (("io", "parser", "data", "sauron.SHIFT_JIS.csv"), "shiftjis"), ], ) -def test_binary_mode_file_buffers( - all_parsers, csv_dir_path, file_path, encoding, datapath -): +def test_binary_mode_file_buffers(all_parsers, file_path, encoding, datapath): # gh-23779: Python csv engine shouldn't error on files opened in binary. # gh-31575: Python csv engine shouldn't error on files opened in raw binary. parser = all_parsers diff --git a/pandas/tests/io/pytables/test_read.py b/pandas/tests/io/pytables/test_read.py index 1c9e63c66aadb..5b8911bcb0141 100644 --- a/pandas/tests/io/pytables/test_read.py +++ b/pandas/tests/io/pytables/test_read.py @@ -137,7 +137,7 @@ def test_read_column(setup_path): tm.assert_series_equal(result, expected) -def test_pytables_native_read(datapath, setup_path): +def test_pytables_native_read(datapath): with ensure_clean_store( datapath("io", "data", "legacy_hdf/pytables_native.h5"), mode="r" ) as store: @@ -146,7 +146,7 @@ def test_pytables_native_read(datapath, setup_path): @pytest.mark.skipif(is_platform_windows(), reason="native2 read fails oddly on windows") -def test_pytables_native2_read(datapath, setup_path): +def test_pytables_native2_read(datapath): with ensure_clean_store( datapath("io", "data", "legacy_hdf", "pytables_native2.h5"), mode="r" ) as store: @@ -155,7 +155,7 @@ def test_pytables_native2_read(datapath, setup_path): assert isinstance(d1, DataFrame) -def test_legacy_table_fixed_format_read_py2(datapath, setup_path): +def test_legacy_table_fixed_format_read_py2(datapath): # GH 24510 # legacy table with fixed format written in Python 2 with ensure_clean_store( @@ -170,7 +170,7 @@ def test_legacy_table_fixed_format_read_py2(datapath, setup_path): tm.assert_frame_equal(expected, result) -def test_legacy_table_fixed_format_read_datetime_py2(datapath, setup_path): +def test_legacy_table_fixed_format_read_datetime_py2(datapath): # GH 31750 # legacy table with fixed format and datetime64 column written in Python 2 with ensure_clean_store( @@ -186,7 +186,7 @@ def test_legacy_table_fixed_format_read_datetime_py2(datapath, setup_path): tm.assert_frame_equal(expected, result) -def test_legacy_table_read_py2(datapath, setup_path): +def test_legacy_table_read_py2(datapath): # issue: 24925 # legacy table written in Python 2 with ensure_clean_store( diff --git a/pandas/tests/io/pytables/test_store.py b/pandas/tests/io/pytables/test_store.py index 73e10adb0c2c3..f20757b09fb36 100644 --- a/pandas/tests/io/pytables/test_store.py +++ b/pandas/tests/io/pytables/test_store.py @@ -223,7 +223,7 @@ def test_versioning(setup_path): ), ], ) -def test_walk(where, expected, setup_path): +def test_walk(where, expected): # GH10143 objs = { "df1": DataFrame([1, 2, 3]), @@ -809,7 +809,7 @@ def test_select_filter_corner(setup_path): tm.assert_frame_equal(result, df.loc[:, df.columns[:75:2]]) -def test_path_pathlib(setup_path): +def test_path_pathlib(): df = tm.makeDataFrame() result = tm.round_trip_pathlib( @@ -835,7 +835,7 @@ def test_contiguous_mixed_data_table(start, stop, setup_path): tm.assert_frame_equal(df[start:stop], result) -def test_path_pathlib_hdfstore(setup_path): +def test_path_pathlib_hdfstore(): df = tm.makeDataFrame() def writer(path): @@ -850,7 +850,7 @@ def reader(path): tm.assert_frame_equal(df, result) -def test_pickle_path_localpath(setup_path): +def test_pickle_path_localpath(): df = tm.makeDataFrame() result = tm.round_trip_pathlib( lambda p: df.to_hdf(p, "df"), lambda p: read_hdf(p, "df") @@ -858,7 +858,7 @@ def test_pickle_path_localpath(setup_path): tm.assert_frame_equal(df, result) -def test_path_localpath_hdfstore(setup_path): +def test_path_localpath_hdfstore(): df = tm.makeDataFrame() def writer(path): @@ -873,7 +873,7 @@ def reader(path): tm.assert_frame_equal(df, result) -def test_copy(setup_path): +def test_copy(): with catch_warnings(record=True): diff --git a/pandas/tests/io/pytables/test_timezones.py b/pandas/tests/io/pytables/test_timezones.py index 36fa79d0bb7e3..e235c73123eaa 100644 --- a/pandas/tests/io/pytables/test_timezones.py +++ b/pandas/tests/io/pytables/test_timezones.py @@ -304,7 +304,7 @@ def test_store_timezone(setup_path): tm.assert_frame_equal(result, df) -def test_legacy_datetimetz_object(datapath, setup_path): +def test_legacy_datetimetz_object(datapath): # legacy from < 0.17.0 # 8260 expected = DataFrame( @@ -356,7 +356,7 @@ def test_read_with_where_tz_aware_index(setup_path): tm.assert_frame_equal(result, expected) -def test_py2_created_with_datetimez(datapath, setup_path): +def test_py2_created_with_datetimez(datapath): # The test HDF5 file was created in Python 2, but could not be read in # Python 3. # diff --git a/pandas/tests/io/xml/test_to_xml.py b/pandas/tests/io/xml/test_to_xml.py index 0666dcacecf39..7b2c2b11dbc27 100644 --- a/pandas/tests/io/xml/test_to_xml.py +++ b/pandas/tests/io/xml/test_to_xml.py @@ -363,21 +363,21 @@ def test_index_false_with_offset_input_index(parser, offset_index): """ -def test_na_elem_output(datapath, parser): +def test_na_elem_output(parser): output = geom_df.to_xml(parser=parser) output = equalize_decl(output) assert output == na_expected -def test_na_empty_str_elem_option(datapath, parser): +def test_na_empty_str_elem_option(parser): output = geom_df.to_xml(na_rep="", parser=parser) output = equalize_decl(output) assert output == na_expected -def test_na_empty_elem_option(datapath, parser): +def test_na_empty_elem_option(parser): expected = """\ @@ -410,7 +410,7 @@ def test_na_empty_elem_option(datapath, parser): # ATTR_COLS -def test_attrs_cols_nan_output(datapath, parser): +def test_attrs_cols_nan_output(parser): expected = """\ @@ -425,7 +425,7 @@ def test_attrs_cols_nan_output(datapath, parser): assert output == expected -def test_attrs_cols_prefix(datapath, parser): +def test_attrs_cols_prefix(parser): expected = """\ @@ -461,7 +461,7 @@ def test_attrs_wrong_type(parser): # ELEM_COLS -def test_elems_cols_nan_output(datapath, parser): +def test_elems_cols_nan_output(parser): elems_cols_expected = """\ @@ -500,7 +500,7 @@ def test_elems_wrong_type(parser): geom_df.to_xml(elem_cols='"shape", "degree", "sides"', parser=parser) -def test_elems_and_attrs_cols(datapath, parser): +def test_elems_and_attrs_cols(parser): elems_cols_expected = """\ @@ -532,7 +532,7 @@ def test_elems_and_attrs_cols(datapath, parser): # HIERARCHICAL COLUMNS -def test_hierarchical_columns(datapath, parser): +def test_hierarchical_columns(parser): expected = """\ @@ -579,7 +579,7 @@ def test_hierarchical_columns(datapath, parser): assert output == expected -def test_hierarchical_attrs_columns(datapath, parser): +def test_hierarchical_attrs_columns(parser): expected = """\ @@ -609,7 +609,7 @@ def test_hierarchical_attrs_columns(datapath, parser): # MULTIINDEX -def test_multi_index(datapath, parser): +def test_multi_index(parser): expected = """\ @@ -648,7 +648,7 @@ def test_multi_index(datapath, parser): assert output == expected -def test_multi_index_attrs_cols(datapath, parser): +def test_multi_index_attrs_cols(parser): expected = """\ @@ -1020,7 +1020,7 @@ def test_stylesheet_buffered_reader(datapath, mode): @td.skip_if_no("lxml") -def test_stylesheet_wrong_path(datapath): +def test_stylesheet_wrong_path(): from lxml.etree import XMLSyntaxError xsl = os.path.join("data", "xml", "row_field_output.xslt") @@ -1102,7 +1102,7 @@ def test_incorrect_xsl_eval(): @td.skip_if_no("lxml") -def test_incorrect_xsl_apply(parser): +def test_incorrect_xsl_apply(): from lxml.etree import XSLTApplyError xsl = """\ @@ -1122,7 +1122,7 @@ def test_incorrect_xsl_apply(parser): geom_df.to_xml(path, stylesheet=xsl) -def test_stylesheet_with_etree(datapath): +def test_stylesheet_with_etree(): xsl = """\ @@ -1322,7 +1322,7 @@ def test_ea_dtypes(any_numeric_ea_dtype, parser): assert equalize_decl(result).strip() == expected -def test_unsuported_compression(datapath, parser): +def test_unsuported_compression(parser): with pytest.raises(ValueError, match="Unrecognized compression type"): with tm.ensure_clean() as path: geom_df.to_xml(path, parser=parser, compression="7z") diff --git a/pandas/tests/io/xml/test_xml.py b/pandas/tests/io/xml/test_xml.py index aef94af60c3dd..03c176fd7bc8b 100644 --- a/pandas/tests/io/xml/test_xml.py +++ b/pandas/tests/io/xml/test_xml.py @@ -257,7 +257,7 @@ def test_parser_consistency_file(datapath): @tm.network @pytest.mark.slow @td.skip_if_no("lxml") -def test_parser_consistency_url(datapath): +def test_parser_consistency_url(): url = ( "https://data.cityofchicago.org/api/views/" "8pix-ypme/rows.xml?accessType=DOWNLOAD" @@ -993,7 +993,7 @@ def test_stylesheet_file_close(datapath, mode): @td.skip_if_no("lxml") -def test_stylesheet_with_etree(datapath): +def test_stylesheet_with_etree(): kml = os.path.join("data", "xml", "cta_rail_lines.kml") xsl = os.path.join("data", "xml", "flatten_doc.xsl") @@ -1090,7 +1090,7 @@ def test_wrong_compression(parser, compression, compression_only): read_xml(path, parser=parser, compression=attempted_compression) -def test_unsuported_compression(datapath, parser): +def test_unsuported_compression(parser): with pytest.raises(ValueError, match="Unrecognized compression type"): with tm.ensure_clean() as path: read_xml(path, parser=parser, compression="7z") diff --git a/pandas/tests/plotting/frame/test_frame.py b/pandas/tests/plotting/frame/test_frame.py index ff247349ff4d5..5cbfb5286bb10 100644 --- a/pandas/tests/plotting/frame/test_frame.py +++ b/pandas/tests/plotting/frame/test_frame.py @@ -746,7 +746,7 @@ def test_plot_scatter_with_categorical_data(self, x, y): _check_plot_works(df.plot.scatter, x=x, y=y) - def test_plot_scatter_with_c(self, request): + def test_plot_scatter_with_c(self): from pandas.plotting._matplotlib.compat import mpl_ge_3_4_0 df = DataFrame( diff --git a/pandas/tests/plotting/test_converter.py b/pandas/tests/plotting/test_converter.py index fe8620ef76c4b..1125975287469 100644 --- a/pandas/tests/plotting/test_converter.py +++ b/pandas/tests/plotting/test_converter.py @@ -157,7 +157,7 @@ def test_registry_resets(self): class TestDateTimeConverter: - def setup_method(self, method): + def setup_method(self): self.dtc = converter.DatetimeConverter() self.tc = converter.TimeFormatter(None) @@ -292,7 +292,7 @@ def test_convert_nested(self): class TestPeriodConverter: - def setup_method(self, method): + def setup_method(self): self.pc = converter.PeriodConverter() class Axis: diff --git a/pandas/tests/resample/test_time_grouper.py b/pandas/tests/resample/test_time_grouper.py index 1557eab5df31a..8a94609900e1d 100644 --- a/pandas/tests/resample/test_time_grouper.py +++ b/pandas/tests/resample/test_time_grouper.py @@ -147,7 +147,7 @@ def test_aggregate_normal(resample_method): @pytest.mark.xfail(reason="if TimeGrouper is used included, 'nth' doesn't work yet") -def test_aggregate_nth(resample_method): +def test_aggregate_nth(): """Check TimeGrouper's aggregation is identical as normal groupby.""" data = np.random.randn(20, 4) diff --git a/pandas/tests/reshape/merge/test_join.py b/pandas/tests/reshape/merge/test_join.py index 7ca3ac325d788..7b932a3bb80c0 100644 --- a/pandas/tests/reshape/merge/test_join.py +++ b/pandas/tests/reshape/merge/test_join.py @@ -23,7 +23,7 @@ class TestJoin: - def setup_method(self, method): + def setup_method(self): # aggregate multiple columns self.df = DataFrame( { diff --git a/pandas/tests/reshape/merge/test_merge.py b/pandas/tests/reshape/merge/test_merge.py index 1249194d3a36d..1f19b464b761b 100644 --- a/pandas/tests/reshape/merge/test_merge.py +++ b/pandas/tests/reshape/merge/test_merge.py @@ -118,7 +118,7 @@ def dfs_for_indicator(): class TestMerge: - def setup_method(self, method): + def setup_method(self): # aggregate multiple columns self.df = DataFrame( { diff --git a/pandas/tests/reshape/merge/test_merge_ordered.py b/pandas/tests/reshape/merge/test_merge_ordered.py index 0268801c66e1d..4d3dc05571d1d 100644 --- a/pandas/tests/reshape/merge/test_merge_ordered.py +++ b/pandas/tests/reshape/merge/test_merge_ordered.py @@ -10,7 +10,7 @@ class TestMergeOrdered: - def setup_method(self, method): + def setup_method(self): self.left = DataFrame({"key": ["a", "c", "e"], "lvalue": [1, 2.0, 3]}) self.right = DataFrame({"key": ["b", "c", "d", "f"], "rvalue": [1, 2, 3.0, 4]}) diff --git a/pandas/tests/reshape/merge/test_multi.py b/pandas/tests/reshape/merge/test_multi.py index b5945f7542077..0dbe45eeb1e82 100644 --- a/pandas/tests/reshape/merge/test_multi.py +++ b/pandas/tests/reshape/merge/test_multi.py @@ -93,7 +93,7 @@ def test_merge_on_multikey(self, left, right, join_type): tm.assert_frame_equal(result, expected) @pytest.mark.parametrize("sort", [False, True]) - def test_left_join_multi_index(self, left, right, sort): + def test_left_join_multi_index(self, sort): icols = ["1st", "2nd", "3rd"] def bind_cols(df): diff --git a/pandas/tests/reshape/test_crosstab.py b/pandas/tests/reshape/test_crosstab.py index cc6eec671ac3a..65b126c0fd98f 100644 --- a/pandas/tests/reshape/test_crosstab.py +++ b/pandas/tests/reshape/test_crosstab.py @@ -16,7 +16,7 @@ class TestCrosstab: - def setup_method(self, method): + def setup_method(self): df = DataFrame( { "A": [ diff --git a/pandas/tests/reshape/test_melt.py b/pandas/tests/reshape/test_melt.py index ff8e5d56cdc93..cbe33642786da 100644 --- a/pandas/tests/reshape/test_melt.py +++ b/pandas/tests/reshape/test_melt.py @@ -12,7 +12,7 @@ class TestMelt: - def setup_method(self, method): + def setup_method(self): self.df = tm.makeTimeDataFrame()[:10] self.df["id1"] = (self.df["A"] > 0).astype(np.int64) self.df["id2"] = (self.df["B"] > 0).astype(np.int64) diff --git a/pandas/tests/reshape/test_pivot.py b/pandas/tests/reshape/test_pivot.py index f4719ba0bda9a..a5ae9902e07b8 100644 --- a/pandas/tests/reshape/test_pivot.py +++ b/pandas/tests/reshape/test_pivot.py @@ -39,7 +39,7 @@ def interval_values(request, closed): class TestPivotTable: - def setup_method(self, method): + def setup_method(self): self.data = DataFrame( { "A": [ @@ -1758,7 +1758,7 @@ def test_categorical_margins_category(self, observed, request): table = df.pivot_table("x", "y", "z", dropna=observed, margins=True) tm.assert_frame_equal(table, expected) - def test_margins_casted_to_float(self, observed): + def test_margins_casted_to_float(self): # GH 24893 df = DataFrame( { diff --git a/pandas/tests/scalar/timestamp/test_comparisons.py b/pandas/tests/scalar/timestamp/test_comparisons.py index 7ed0a6aedebc1..b5084e7a8925e 100644 --- a/pandas/tests/scalar/timestamp/test_comparisons.py +++ b/pandas/tests/scalar/timestamp/test_comparisons.py @@ -12,7 +12,7 @@ class TestTimestampComparison: - def test_comparison_dt64_ndarray(self, fixed_now_ts): + def test_comparison_dt64_ndarray(self): ts = Timestamp("2021-01-01") ts2 = Timestamp("2019-04-05") arr = np.array([[ts.asm8, ts2.asm8]], dtype="M8[ns]") diff --git a/pandas/tests/series/indexing/test_indexing.py b/pandas/tests/series/indexing/test_indexing.py index b82fa1b7f23c1..3c83ac4e1f623 100644 --- a/pandas/tests/series/indexing/test_indexing.py +++ b/pandas/tests/series/indexing/test_indexing.py @@ -165,7 +165,7 @@ def test_setitem_ambiguous_keyerror(indexer_sl): tm.assert_series_equal(s2, expected) -def test_setitem(datetime_series, string_series): +def test_setitem(datetime_series): datetime_series[datetime_series.index[5]] = np.NaN datetime_series[[1, 2, 17]] = np.NaN datetime_series[6] = np.NaN diff --git a/pandas/tests/series/indexing/test_setitem.py b/pandas/tests/series/indexing/test_setitem.py index 9d1ee70c265e8..667dae55ef9df 100644 --- a/pandas/tests/series/indexing/test_setitem.py +++ b/pandas/tests/series/indexing/test_setitem.py @@ -715,7 +715,7 @@ def test_series_where(self, obj, key, expected, val, is_inplace): self._check_inplace(is_inplace, orig, arr, obj) - def test_index_where(self, obj, key, expected, val, request): + def test_index_where(self, obj, key, expected, val): if obj.dtype == bool or obj.dtype.kind == "c" or expected.dtype.kind == "c": # TODO(GH#45061): Should become unreachable (at least the bool part) pytest.skip("test not applicable for this dtype") diff --git a/pandas/tests/series/indexing/test_where.py b/pandas/tests/series/indexing/test_where.py index 9ed04885bd9e1..eabaf23bd36f8 100644 --- a/pandas/tests/series/indexing/test_where.py +++ b/pandas/tests/series/indexing/test_where.py @@ -438,7 +438,7 @@ def test_where_categorical(frame_or_series): tm.assert_equal(exp, res) -def test_where_datetimelike_categorical(request, tz_naive_fixture): +def test_where_datetimelike_categorical(tz_naive_fixture): # GH#37682 tz = tz_naive_fixture diff --git a/pandas/tests/series/methods/test_interpolate.py b/pandas/tests/series/methods/test_interpolate.py index 8ca2d37016691..304bfc308fd70 100644 --- a/pandas/tests/series/methods/test_interpolate.py +++ b/pandas/tests/series/methods/test_interpolate.py @@ -78,7 +78,7 @@ def interp_methods_ind(request): class TestSeriesInterpolateData: - def test_interpolate(self, datetime_series, string_series): + def test_interpolate(self, datetime_series): ts = Series(np.arange(len(datetime_series), dtype=float), datetime_series.index) ts_copy = ts.copy() diff --git a/pandas/tests/series/test_arithmetic.py b/pandas/tests/series/test_arithmetic.py index 5fbb42789d746..f2b561c77d246 100644 --- a/pandas/tests/series/test_arithmetic.py +++ b/pandas/tests/series/test_arithmetic.py @@ -722,9 +722,7 @@ def test_align_date_objects_with_datetimeindex(self): class TestNamePreservation: @pytest.mark.parametrize("box", [list, tuple, np.array, Index, Series, pd.array]) @pytest.mark.parametrize("flex", [True, False]) - def test_series_ops_name_retention( - self, request, flex, box, names, all_binary_operators - ): + def test_series_ops_name_retention(self, flex, box, names, all_binary_operators): # GH#33930 consistent name renteiton op = all_binary_operators diff --git a/pandas/tests/series/test_ufunc.py b/pandas/tests/series/test_ufunc.py index ed07a31c24768..b0201db798789 100644 --- a/pandas/tests/series/test_ufunc.py +++ b/pandas/tests/series/test_ufunc.py @@ -176,9 +176,7 @@ def test_binary_ufunc_scalar(ufunc, sparse, flip, arrays_for_binary_ufunc): @pytest.mark.parametrize("sparse", SPARSE, ids=SPARSE_IDS) @pytest.mark.parametrize("shuffle", SHUFFLE) @pytest.mark.filterwarnings("ignore:divide by zero:RuntimeWarning") -def test_multiple_output_binary_ufuncs( - ufunc, sparse, shuffle, arrays_for_binary_ufunc, request -): +def test_multiple_output_binary_ufuncs(ufunc, sparse, shuffle, arrays_for_binary_ufunc): # Test that # the same conditions from binary_ufunc_scalar apply to # ufuncs with multiple outputs. diff --git a/pandas/tests/strings/test_strings.py b/pandas/tests/strings/test_strings.py index b72dd111f3b25..9a82110f65f83 100644 --- a/pandas/tests/strings/test_strings.py +++ b/pandas/tests/strings/test_strings.py @@ -360,9 +360,7 @@ def test_len_mixed(): ("rindex", "E", 0, 5, [4, 3, 1, 4]), ], ) -def test_index( - method, sub, start, end, index_or_series, any_string_dtype, expected, request -): +def test_index(method, sub, start, end, index_or_series, any_string_dtype, expected): obj = index_or_series( ["ABCDEFG", "BCDEFEF", "DEFGHIJEF", "EFGHEF"], dtype=any_string_dtype diff --git a/pandas/tests/test_downstream.py b/pandas/tests/test_downstream.py index b843a92850250..f64c7fa27201a 100644 --- a/pandas/tests/test_downstream.py +++ b/pandas/tests/test_downstream.py @@ -149,7 +149,7 @@ def test_statsmodels(): # Cython import warning @pytest.mark.filterwarnings("ignore:can't:ImportWarning") -def test_scikit_learn(df): +def test_scikit_learn(): sklearn = import_module("sklearn") # noqa:F841 from sklearn import ( @@ -173,7 +173,7 @@ def test_seaborn(): seaborn.stripplot(x="day", y="total_bill", data=tips) -def test_pandas_gbq(df): +def test_pandas_gbq(): pandas_gbq = import_module("pandas_gbq") # noqa:F841 diff --git a/pandas/tests/test_expressions.py b/pandas/tests/test_expressions.py index 495fd637d01fe..a0066ace17bc4 100644 --- a/pandas/tests/test_expressions.py +++ b/pandas/tests/test_expressions.py @@ -47,10 +47,10 @@ @pytest.mark.skipif(not expr.USE_NUMEXPR, reason="not using numexpr") class TestExpressions: - def setup_method(self, method): + def setup_method(self): self._MIN_ELEMENTS = expr._MIN_ELEMENTS - def teardown_method(self, method): + def teardown_method(self): expr._MIN_ELEMENTS = self._MIN_ELEMENTS @staticmethod diff --git a/pandas/tests/test_nanops.py b/pandas/tests/test_nanops.py index fa95ff86cb6b9..c58cb0db00113 100644 --- a/pandas/tests/test_nanops.py +++ b/pandas/tests/test_nanops.py @@ -31,7 +31,7 @@ def skipna(request): class TestnanopsDataFrame: - def setup_method(self, method): + def setup_method(self): np.random.seed(11235) nanops._USE_BOTTLENECK = False @@ -95,7 +95,7 @@ def setup_method(self, method): self.arr_float1_nan_1d = self.arr_float1_nan[:, 0] self.arr_nan_float1_1d = self.arr_nan_float1[:, 0] - def teardown_method(self, method): + def teardown_method(self): nanops._USE_BOTTLENECK = use_bn def check_results(self, targ, res, axis, check_dtype=True): @@ -786,7 +786,7 @@ class TestNanvarFixedValues: # xref GH10242 - def setup_method(self, method): + def setup_method(self): # Samples from a normal distribution. self.variance = variance = 3.0 self.samples = self.prng.normal(scale=variance ** 0.5, size=100000) @@ -903,7 +903,7 @@ class TestNanskewFixedValues: # xref GH 11974 - def setup_method(self, method): + def setup_method(self): # Test data + skewness value (computed with scipy.stats.skew) self.samples = np.sin(np.linspace(0, 1, 200)) self.actual_skew = -0.1875895205961754 @@ -952,7 +952,7 @@ class TestNankurtFixedValues: # xref GH 11974 - def setup_method(self, method): + def setup_method(self): # Test data + kurtosis value (computed with scipy.stats.kurtosis) self.samples = np.sin(np.linspace(0, 1, 200)) self.actual_kurt = -1.2058303433799713 diff --git a/pandas/tests/tseries/offsets/test_business_day.py b/pandas/tests/tseries/offsets/test_business_day.py index 482d697b15e98..58d3985913994 100644 --- a/pandas/tests/tseries/offsets/test_business_day.py +++ b/pandas/tests/tseries/offsets/test_business_day.py @@ -34,7 +34,7 @@ class TestBusinessDay(Base): _offset = BDay - def setup_method(self, method): + def setup_method(self): self.d = datetime(2008, 1, 1) self.nd = np.datetime64("2008-01-01 00:00:00") diff --git a/pandas/tests/tseries/offsets/test_business_hour.py b/pandas/tests/tseries/offsets/test_business_hour.py index 401bfe664a3a2..314308c7e06f0 100644 --- a/pandas/tests/tseries/offsets/test_business_hour.py +++ b/pandas/tests/tseries/offsets/test_business_hour.py @@ -32,7 +32,7 @@ class TestBusinessHour(Base): _offset = BusinessHour - def setup_method(self, method): + def setup_method(self): self.d = datetime(2014, 7, 1, 10, 00) self.offset1 = BusinessHour() diff --git a/pandas/tests/tseries/offsets/test_custom_business_hour.py b/pandas/tests/tseries/offsets/test_custom_business_hour.py index dbc0ff4371fd9..3fc20df2d930b 100644 --- a/pandas/tests/tseries/offsets/test_custom_business_hour.py +++ b/pandas/tests/tseries/offsets/test_custom_business_hour.py @@ -26,7 +26,7 @@ class TestCustomBusinessHour(Base): _offset = CustomBusinessHour holidays = ["2014-06-27", datetime(2014, 6, 30), np.datetime64("2014-07-02")] - def setup_method(self, method): + def setup_method(self): # 2014 Calendar to check custom holidays # Sun Mon Tue Wed Thu Fri Sat # 6/22 23 24 25 26 27 28 diff --git a/pandas/tests/tseries/offsets/test_custom_business_month.py b/pandas/tests/tseries/offsets/test_custom_business_month.py index fb0f331fa3ad3..935213229a65a 100644 --- a/pandas/tests/tseries/offsets/test_custom_business_month.py +++ b/pandas/tests/tseries/offsets/test_custom_business_month.py @@ -35,7 +35,7 @@ class CustomBusinessMonthBase: - def setup_method(self, method): + def setup_method(self): self.d = datetime(2008, 1, 1) self.offset = self._offset() self.offset1 = self.offset diff --git a/pandas/tests/tseries/offsets/test_offsets.py b/pandas/tests/tseries/offsets/test_offsets.py index 5dcfd0019e93f..3a9dde59dcef3 100644 --- a/pandas/tests/tseries/offsets/test_offsets.py +++ b/pandas/tests/tseries/offsets/test_offsets.py @@ -537,7 +537,7 @@ def test_offsets_hashable(self, offset_types): class TestDateOffset(Base): - def setup_method(self, method): + def setup_method(self): self.d = Timestamp(datetime(2008, 1, 2)) _offset_map.clear() @@ -622,7 +622,7 @@ def test_get_offset_legacy(): class TestOffsetAliases: - def setup_method(self, method): + def setup_method(self): _offset_map.clear() def test_alias_equality(self):