Skip to content

Commit 41f3c2e

Browse files
authored
CLN: Some unit tests (#58599)
1 parent eb36970 commit 41f3c2e

File tree

9 files changed

+15
-29
lines changed

9 files changed

+15
-29
lines changed

pandas/tests/apply/test_frame_apply.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1489,7 +1489,7 @@ def test_apply_dtype(col):
14891489

14901490
def test_apply_mutating():
14911491
# GH#35462 case where applied func pins a new BlockManager to a row
1492-
df = DataFrame({"a": range(100), "b": range(100, 200)})
1492+
df = DataFrame({"a": range(10), "b": range(10, 20)})
14931493
df_orig = df.copy()
14941494

14951495
def func(row):

pandas/tests/apply/test_str.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
],
2929
)
3030
@pytest.mark.parametrize("how", ["agg", "apply"])
31-
def test_apply_with_string_funcs(request, float_frame, func, kwds, how):
31+
def test_apply_with_string_funcs(float_frame, func, kwds, how):
3232
result = getattr(float_frame, how)(func, **kwds)
3333
expected = getattr(float_frame, func)(**kwds)
3434
tm.assert_series_equal(result, expected)

pandas/tests/arithmetic/test_datetime64.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1080,7 +1080,7 @@ def test_dt64arr_add_dtlike_raises(self, tz_naive_fixture, box_with_array):
10801080
@pytest.mark.parametrize("freq", ["h", "D", "W", "2ME", "MS", "QE", "B", None])
10811081
@pytest.mark.parametrize("dtype", [None, "uint8"])
10821082
def test_dt64arr_addsub_intlike(
1083-
self, request, dtype, index_or_series_or_array, freq, tz_naive_fixture
1083+
self, dtype, index_or_series_or_array, freq, tz_naive_fixture
10841084
):
10851085
# GH#19959, GH#19123, GH#19012
10861086
# GH#55860 use index_or_series_or_array instead of box_with_array

pandas/tests/base/test_conversion.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ def test_numpy_array_all_dtypes(any_numpy_dtype):
270270
),
271271
],
272272
)
273-
def test_array(arr, attr, index_or_series, request):
273+
def test_array(arr, attr, index_or_series):
274274
box = index_or_series
275275

276276
result = box(arr, copy=False).array
@@ -383,7 +383,7 @@ def test_to_numpy_copy(arr, as_series, using_infer_string):
383383

384384

385385
@pytest.mark.parametrize("as_series", [True, False])
386-
def test_to_numpy_dtype(as_series, unit):
386+
def test_to_numpy_dtype(as_series):
387387
tz = "US/Eastern"
388388
obj = pd.DatetimeIndex(["2000", "2001"], tz=tz)
389389
if as_series:

pandas/tests/base/test_value_counts.py

+2-15
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,6 @@ def test_value_counts(index_or_series_obj):
4747
# i.e IntegerDtype
4848
expected = expected.astype("Int64")
4949

50-
# TODO(GH#32514): Order of entries with the same count is inconsistent
51-
# on CI (gh-32449)
52-
if obj.duplicated().any():
53-
result = result.sort_index()
54-
expected = expected.sort_index()
5550
tm.assert_series_equal(result, expected)
5651

5752

@@ -89,11 +84,6 @@ def test_value_counts_null(null_obj, index_or_series_obj):
8984
expected.index.name = obj.name
9085

9186
result = obj.value_counts()
92-
if obj.duplicated().any():
93-
# TODO(GH#32514):
94-
# Order of entries with the same count is inconsistent on CI (gh-32449)
95-
expected = expected.sort_index()
96-
result = result.sort_index()
9787

9888
if not isinstance(result.dtype, np.dtype):
9989
if getattr(obj.dtype, "storage", "") == "pyarrow":
@@ -106,11 +96,8 @@ def test_value_counts_null(null_obj, index_or_series_obj):
10696
expected[null_obj] = 3
10797

10898
result = obj.value_counts(dropna=False)
109-
if obj.duplicated().any():
110-
# TODO(GH#32514):
111-
# Order of entries with the same count is inconsistent on CI (gh-32449)
112-
expected = expected.sort_index()
113-
result = result.sort_index()
99+
expected = expected.sort_index()
100+
result = result.sort_index()
114101
tm.assert_series_equal(result, expected)
115102

116103

pandas/tests/computation/test_eval.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -1984,9 +1984,8 @@ def test_set_inplace():
19841984
tm.assert_series_equal(result_view["A"], expected)
19851985

19861986

1987-
class TestValidate:
1988-
@pytest.mark.parametrize("value", [1, "True", [1, 2, 3], 5.0])
1989-
def test_validate_bool_args(self, value):
1990-
msg = 'For argument "inplace" expected type bool, received type'
1991-
with pytest.raises(ValueError, match=msg):
1992-
pd.eval("2+2", inplace=value)
1987+
@pytest.mark.parametrize("value", [1, "True", [1, 2, 3], 5.0])
1988+
def test_validate_bool_args(value):
1989+
msg = 'For argument "inplace" expected type bool, received type'
1990+
with pytest.raises(ValueError, match=msg):
1991+
pd.eval("2+2", inplace=value)

pandas/tests/frame/test_ufunc.py

+1
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ def test_alignment_deprecation_enforced():
245245
np.add(s2, df1)
246246

247247

248+
@pytest.mark.single_cpu
248249
def test_alignment_deprecation_many_inputs_enforced():
249250
# Enforced in 2.0
250251
# https://github.com/pandas-dev/pandas/issues/39184

pandas/tests/test_multilevel.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,7 @@ def test_groupby_multilevel(self, multiindex_year_month_day_dataframe_random_dat
121121

122122
expected = ymd.groupby([k1, k2]).mean()
123123

124-
# TODO groupby with level_values drops names
125-
tm.assert_frame_equal(result, expected, check_names=False)
124+
tm.assert_frame_equal(result, expected)
126125
assert result.index.names == ymd.index.names[:2]
127126

128127
result2 = ymd.groupby(level=ymd.index.names[:2]).mean()

pandas/tests/window/test_expanding.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ def test_expanding_cov_pairwise_diff_length():
550550
df2a = DataFrame(
551551
[[5, 6], [2, 1]], index=[0, 2], columns=Index(["X", "Y"], name="foo")
552552
)
553-
# TODO: xref gh-15826
553+
# xref gh-15826
554554
# .loc is not preserving the names
555555
result1 = df1.expanding().cov(df2, pairwise=True).loc[2]
556556
result2 = df1.expanding().cov(df2a, pairwise=True).loc[2]

0 commit comments

Comments
 (0)