Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mypy error in pandas/tests.indexes.test_base.py #29188

Merged
merged 14 commits into from
Nov 27, 2019
36 changes: 18 additions & 18 deletions pandas/tests/indexes/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ def test_constructor_dtypes_timedelta(self, attr, klass):
result = klass(list(values), dtype=dtype)
tm.assert_index_equal(result, index)

@pytest.mark.parametrize("value", [[], iter([]), (x for x in [])])
@pytest.mark.parametrize("value", [[], iter([]), (_ for _ in [])])
@pytest.mark.parametrize(
"klass",
[
Expand All @@ -530,7 +530,7 @@ def test_constructor_empty(self, value, klass):
[
(PeriodIndex([], freq="B"), PeriodIndex),
(PeriodIndex(iter([]), freq="B"), PeriodIndex),
(PeriodIndex((x for x in []), freq="B"), PeriodIndex),
(PeriodIndex((_ for _ in []), freq="B"), PeriodIndex),
(RangeIndex(step=1), pd.RangeIndex),
(MultiIndex(levels=[[1, 2], ["blue", "red"]], codes=[[], []]), MultiIndex),
],
Expand Down Expand Up @@ -1732,23 +1732,23 @@ def test_slice_locs_na_raises(self):
@pytest.mark.parametrize(
"in_slice,expected",
[
(pd.IndexSlice[::-1], "yxdcb"),
(pd.IndexSlice["b":"y":-1], ""),
(pd.IndexSlice["b"::-1], "b"),
(pd.IndexSlice[:"b":-1], "yxdcb"),
(pd.IndexSlice[:"y":-1], "y"),
(pd.IndexSlice["y"::-1], "yxdcb"),
(pd.IndexSlice["y"::-4], "yb"),
(pd.IndexSlice[::-1], "yxdcb"), # type: ignore
rushabh-v marked this conversation as resolved.
Show resolved Hide resolved
(pd.IndexSlice["b":"y":-1], ""), # type: ignore
(pd.IndexSlice["b"::-1], "b"), # type: ignore
(pd.IndexSlice[:"b":-1], "yxdcb"), # type: ignore
(pd.IndexSlice[:"y":-1], "y"), # type: ignore
(pd.IndexSlice["y"::-1], "yxdcb"), # type: ignore
(pd.IndexSlice["y"::-4], "yb"), # type: ignore
# absent labels
(pd.IndexSlice[:"a":-1], "yxdcb"),
(pd.IndexSlice[:"a":-2], "ydb"),
(pd.IndexSlice["z"::-1], "yxdcb"),
(pd.IndexSlice["z"::-3], "yc"),
(pd.IndexSlice["m"::-1], "dcb"),
(pd.IndexSlice[:"m":-1], "yx"),
(pd.IndexSlice["a":"a":-1], ""),
(pd.IndexSlice["z":"z":-1], ""),
(pd.IndexSlice["m":"m":-1], ""),
(pd.IndexSlice[:"a":-1], "yxdcb"), # type: ignore
(pd.IndexSlice[:"a":-2], "ydb"), # type: ignore
(pd.IndexSlice["z"::-1], "yxdcb"), # type: ignore
(pd.IndexSlice["z"::-3], "yc"), # type: ignore
(pd.IndexSlice["m"::-1], "dcb"), # type: ignore
(pd.IndexSlice[:"m":-1], "yx"), # type: ignore
(pd.IndexSlice["a":"a":-1], ""), # type: ignore
(pd.IndexSlice["z":"z":-1], ""), # type: ignore
(pd.IndexSlice["m":"m":-1], ""), # type: ignore
],
)
def test_slice_locs_negative_step(self, in_slice, expected):
Expand Down
3 changes: 0 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,6 @@ ignore_errors=True
[mypy-pandas.tests.indexes.datetimes.test_tools]
ignore_errors=True

[mypy-pandas.tests.indexes.test_base]
ignore_errors=True

[mypy-pandas.tests.scalar.period.test_period]
ignore_errors=True

Expand Down