Skip to content

Commit 6d3a08a

Browse files
rushabh-vWillAyd
authored andcommitted
Fix mypy error in pandas/tests.indexes.test_base.py (#29188)
1 parent 896dbc3 commit 6d3a08a

File tree

2 files changed

+17
-20
lines changed

2 files changed

+17
-20
lines changed

pandas/tests/indexes/test_base.py

+17-17
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ def test_constructor_dtypes_timedelta(self, attr, klass):
507507
result = klass(list(values), dtype=dtype)
508508
tm.assert_index_equal(result, index)
509509

510-
@pytest.mark.parametrize("value", [[], iter([]), (x for x in [])])
510+
@pytest.mark.parametrize("value", [[], iter([]), (_ for _ in [])])
511511
@pytest.mark.parametrize(
512512
"klass",
513513
[
@@ -530,7 +530,7 @@ def test_constructor_empty(self, value, klass):
530530
[
531531
(PeriodIndex([], freq="B"), PeriodIndex),
532532
(PeriodIndex(iter([]), freq="B"), PeriodIndex),
533-
(PeriodIndex((x for x in []), freq="B"), PeriodIndex),
533+
(PeriodIndex((_ for _ in []), freq="B"), PeriodIndex),
534534
(RangeIndex(step=1), pd.RangeIndex),
535535
(MultiIndex(levels=[[1, 2], ["blue", "red"]], codes=[[], []]), MultiIndex),
536536
],
@@ -1726,22 +1726,22 @@ def test_slice_locs_na_raises(self):
17261726
"in_slice,expected",
17271727
[
17281728
(pd.IndexSlice[::-1], "yxdcb"),
1729-
(pd.IndexSlice["b":"y":-1], ""),
1730-
(pd.IndexSlice["b"::-1], "b"),
1731-
(pd.IndexSlice[:"b":-1], "yxdcb"),
1732-
(pd.IndexSlice[:"y":-1], "y"),
1733-
(pd.IndexSlice["y"::-1], "yxdcb"),
1734-
(pd.IndexSlice["y"::-4], "yb"),
1729+
(pd.IndexSlice["b":"y":-1], ""), # type: ignore
1730+
(pd.IndexSlice["b"::-1], "b"), # type: ignore
1731+
(pd.IndexSlice[:"b":-1], "yxdcb"), # type: ignore
1732+
(pd.IndexSlice[:"y":-1], "y"), # type: ignore
1733+
(pd.IndexSlice["y"::-1], "yxdcb"), # type: ignore
1734+
(pd.IndexSlice["y"::-4], "yb"), # type: ignore
17351735
# absent labels
1736-
(pd.IndexSlice[:"a":-1], "yxdcb"),
1737-
(pd.IndexSlice[:"a":-2], "ydb"),
1738-
(pd.IndexSlice["z"::-1], "yxdcb"),
1739-
(pd.IndexSlice["z"::-3], "yc"),
1740-
(pd.IndexSlice["m"::-1], "dcb"),
1741-
(pd.IndexSlice[:"m":-1], "yx"),
1742-
(pd.IndexSlice["a":"a":-1], ""),
1743-
(pd.IndexSlice["z":"z":-1], ""),
1744-
(pd.IndexSlice["m":"m":-1], ""),
1736+
(pd.IndexSlice[:"a":-1], "yxdcb"), # type: ignore
1737+
(pd.IndexSlice[:"a":-2], "ydb"), # type: ignore
1738+
(pd.IndexSlice["z"::-1], "yxdcb"), # type: ignore
1739+
(pd.IndexSlice["z"::-3], "yc"), # type: ignore
1740+
(pd.IndexSlice["m"::-1], "dcb"), # type: ignore
1741+
(pd.IndexSlice[:"m":-1], "yx"), # type: ignore
1742+
(pd.IndexSlice["a":"a":-1], ""), # type: ignore
1743+
(pd.IndexSlice["z":"z":-1], ""), # type: ignore
1744+
(pd.IndexSlice["m":"m":-1], ""), # type: ignore
17451745
],
17461746
)
17471747
def test_slice_locs_negative_step(self, in_slice, expected):

setup.cfg

-3
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,6 @@ ignore_errors=True
148148
[mypy-pandas.tests.indexes.datetimes.test_tools]
149149
ignore_errors=True
150150

151-
[mypy-pandas.tests.indexes.test_base]
152-
ignore_errors=True
153-
154151
[mypy-pandas.tests.scalar.period.test_period]
155152
ignore_errors=True
156153

0 commit comments

Comments
 (0)