Skip to content

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

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

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
25 changes: 13 additions & 12 deletions pandas/tests/tseries/offsets/test_offsets.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from datetime import date, datetime, time as dt_time, timedelta
from typing import Callable, Dict, List, Tuple, Union

import numpy as np
import pytest
Expand Down Expand Up @@ -92,7 +93,7 @@ def test_to_M8():


class Base:
_offset = None
_offset = None # type: Union[BusinessHour, CustomBusinessHour, Callable]
d = Timestamp(datetime(2008, 1, 2))

timezones = [
Expand Down Expand Up @@ -659,7 +660,7 @@ def test_eq(self):


class TestBusinessDay(Base):
_offset = BDay
_offset = BDay # type: Callable

def setup_method(self, method):
self.d = datetime(2008, 1, 1)
Expand Down Expand Up @@ -740,7 +741,7 @@ def test_onOffset(self):
for offset, d, expected in tests:
assert_onOffset(offset, d, expected)

apply_cases = []
apply_cases = [] # type: List[Tuple[int, Dict[datetime, datetime]]]
apply_cases.append(
(
BDay(),
Expand Down Expand Up @@ -1697,7 +1698,7 @@ def test_opening_time(self, case):
assert offset._next_opening_time(dt) == exp_next
assert offset._prev_opening_time(dt) == exp_prev

apply_cases = []
apply_cases = [] # type: List[Tuple[int, Dict[datetime, datetime]]]
apply_cases.append(
(
BusinessHour(),
Expand Down Expand Up @@ -2631,7 +2632,7 @@ def test_onOffset(self, case):
apply_cases = []
apply_cases.append(
(
CDay(),
1 * CDay(),
{
datetime(2008, 1, 1): datetime(2008, 1, 2),
datetime(2008, 1, 4): datetime(2008, 1, 7),
Expand Down Expand Up @@ -2878,7 +2879,7 @@ def test_onOffset(self, case):
apply_cases = []
apply_cases.append(
(
CBMonthEnd(),
1 * CBMonthEnd(),
Copy link
Member

Choose a reason for hiding this comment

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

remove, use alias on L2879 instead

{
datetime(2008, 1, 1): datetime(2008, 1, 31),
datetime(2008, 2, 7): datetime(2008, 2, 29),
Expand Down Expand Up @@ -3027,7 +3028,7 @@ def test_onOffset(self, case):
apply_cases = []
apply_cases.append(
(
CBMonthBegin(),
1 * CBMonthBegin(),
Copy link
Member

Choose a reason for hiding this comment

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

remove

{
datetime(2008, 1, 1): datetime(2008, 2, 1),
datetime(2008, 2, 7): datetime(2008, 3, 3),
Expand Down Expand Up @@ -3120,7 +3121,7 @@ def test_datetimeindex(self):


class TestWeek(Base):
_offset = Week
_offset = Week # type: Callable
d = Timestamp(datetime(2008, 1, 2))
offset1 = _offset()
offset2 = _offset(2)
Expand Down Expand Up @@ -3219,7 +3220,7 @@ def test_onOffset(self, weekday):


class TestWeekOfMonth(Base):
_offset = WeekOfMonth
_offset = WeekOfMonth # type: Callable
offset1 = _offset()
offset2 = _offset(2)

Expand Down Expand Up @@ -3319,7 +3320,7 @@ def test_onOffset(self, case):


class TestLastWeekOfMonth(Base):
_offset = LastWeekOfMonth
_offset = LastWeekOfMonth # type: Callable
offset1 = _offset()
offset2 = _offset(2)

Expand Down Expand Up @@ -3396,7 +3397,7 @@ def test_onOffset(self, case):


class TestSemiMonthEnd(Base):
_offset = SemiMonthEnd
_offset = SemiMonthEnd # type: Callable
offset1 = _offset()
offset2 = _offset(2)

Expand Down Expand Up @@ -3655,7 +3656,7 @@ def test_vectorized_offset_addition(self, klass):


class TestSemiMonthBegin(Base):
_offset = SemiMonthBegin
_offset = SemiMonthBegin # type: Callable
offset1 = _offset()
offset2 = _offset(2)

Expand Down
3 changes: 0 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,5 @@ ignore_errors=True
[mypy-pandas.tests.test_base]
ignore_errors=True

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

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