Skip to content

Fix mypy error messages in pandas/test/tseries/offsets/test_offsets.py #29340

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

Merged
merged 6 commits into from
Nov 7, 2019
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions pandas/tests/tseries/offsets/test_offsets.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from datetime import date, datetime, time as dt_time, timedelta
from typing import Type
from typing import Dict, List, Tuple, Type

import numpy as np
import pytest
Expand Down Expand Up @@ -90,6 +90,7 @@ def test_to_M8():
#####
# DateOffset Tests
#####
_ApplyCases = List[Tuple[int, Dict[datetime, datetime]]]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_ApplyCases = List[Tuple[int, Dict[datetime, datetime]]]
_ApplyCases = List[Tuple[BaseOffset, Dict[datetime, datetime]]]

Kind of tricky but I don't think int is in play at all here but these are rather all BaseOffset subclasses.

This only "works" because there is no stub for pandas.tseries.offsets and all of the instances here resolve to Any. Assumedly if we stubbed that module it would cause failures if this stays as int

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point. Have just pushed this change.



class Base:
Expand Down Expand Up @@ -741,7 +742,7 @@ def test_onOffset(self):
for offset, d, expected in tests:
assert_onOffset(offset, d, expected)

apply_cases = []
apply_cases = [] # type: _ApplyCases
apply_cases.append(
(
BDay(),
Expand Down Expand Up @@ -2629,7 +2630,7 @@ def test_onOffset(self, case):
offset, d, expected = case
assert_onOffset(offset, d, expected)

apply_cases = []
apply_cases = [] # type: _ApplyCases
apply_cases.append(
(
CDay(),
Expand Down Expand Up @@ -2876,7 +2877,7 @@ def test_onOffset(self, case):
offset, d, expected = case
assert_onOffset(offset, d, expected)

apply_cases = []
apply_cases = [] # type: _ApplyCases
apply_cases.append(
(
CBMonthEnd(),
Expand Down Expand Up @@ -3025,7 +3026,7 @@ def test_onOffset(self, case):
offset, dt, expected = case
assert_onOffset(offset, dt, expected)

apply_cases = []
apply_cases = [] # type: _ApplyCases
apply_cases.append(
(
CBMonthBegin(),
Expand Down
3 changes: 0 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,3 @@ ignore_errors=True

[mypy-pandas.tests.series.test_operators]
ignore_errors=True

[mypy-pandas.tests.tseries.offsets.test_offsets]
ignore_errors=True