Skip to content

Commit 4972b17

Browse files
committed
Fix mypy error messages in pandas/test/tseries/offsets/test_offsets.py
1 parent 04d7931 commit 4972b17

File tree

2 files changed

+13
-16
lines changed

2 files changed

+13
-16
lines changed

pandas/tests/tseries/offsets/test_offsets.py

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from datetime import date, datetime, time as dt_time, timedelta
2-
2+
from typing import List, Tuple, Dict, Union, Callable
33
import numpy as np
44
import pytest
55

@@ -92,7 +92,7 @@ def test_to_M8():
9292

9393

9494
class Base:
95-
_offset = None
95+
_offset = None # type: Union[BusinessHour, CustomBusinessHour, Callable]
9696
d = Timestamp(datetime(2008, 1, 2))
9797

9898
timezones = [
@@ -659,7 +659,7 @@ def test_eq(self):
659659

660660

661661
class TestBusinessDay(Base):
662-
_offset = BDay
662+
_offset = BDay # type: Callable
663663

664664
def setup_method(self, method):
665665
self.d = datetime(2008, 1, 1)
@@ -740,7 +740,7 @@ def test_onOffset(self):
740740
for offset, d, expected in tests:
741741
assert_onOffset(offset, d, expected)
742742

743-
apply_cases = []
743+
apply_cases = [] # type: List[Tuple[int, Dict[datetime, datetime]]]
744744
apply_cases.append(
745745
(
746746
BDay(),
@@ -1697,7 +1697,7 @@ def test_opening_time(self, case):
16971697
assert offset._next_opening_time(dt) == exp_next
16981698
assert offset._prev_opening_time(dt) == exp_prev
16991699

1700-
apply_cases = []
1700+
apply_cases = [] # type: List[Tuple[int, Dict[datetime, datetime]]]
17011701
apply_cases.append(
17021702
(
17031703
BusinessHour(),
@@ -2631,7 +2631,7 @@ def test_onOffset(self, case):
26312631
apply_cases = []
26322632
apply_cases.append(
26332633
(
2634-
CDay(),
2634+
1 * CDay(),
26352635
{
26362636
datetime(2008, 1, 1): datetime(2008, 1, 2),
26372637
datetime(2008, 1, 4): datetime(2008, 1, 7),
@@ -2878,7 +2878,7 @@ def test_onOffset(self, case):
28782878
apply_cases = []
28792879
apply_cases.append(
28802880
(
2881-
CBMonthEnd(),
2881+
1 * CBMonthEnd(),
28822882
{
28832883
datetime(2008, 1, 1): datetime(2008, 1, 31),
28842884
datetime(2008, 2, 7): datetime(2008, 2, 29),
@@ -3027,7 +3027,7 @@ def test_onOffset(self, case):
30273027
apply_cases = []
30283028
apply_cases.append(
30293029
(
3030-
CBMonthBegin(),
3030+
1 * CBMonthBegin(),
30313031
{
30323032
datetime(2008, 1, 1): datetime(2008, 2, 1),
30333033
datetime(2008, 2, 7): datetime(2008, 3, 3),
@@ -3120,7 +3120,7 @@ def test_datetimeindex(self):
31203120

31213121

31223122
class TestWeek(Base):
3123-
_offset = Week
3123+
_offset = Week # type: Callable
31243124
d = Timestamp(datetime(2008, 1, 2))
31253125
offset1 = _offset()
31263126
offset2 = _offset(2)
@@ -3219,7 +3219,7 @@ def test_onOffset(self, weekday):
32193219

32203220

32213221
class TestWeekOfMonth(Base):
3222-
_offset = WeekOfMonth
3222+
_offset = WeekOfMonth # type: Callable
32233223
offset1 = _offset()
32243224
offset2 = _offset(2)
32253225

@@ -3319,7 +3319,7 @@ def test_onOffset(self, case):
33193319

33203320

33213321
class TestLastWeekOfMonth(Base):
3322-
_offset = LastWeekOfMonth
3322+
_offset = LastWeekOfMonth # type: Callable
33233323
offset1 = _offset()
33243324
offset2 = _offset(2)
33253325

@@ -3396,7 +3396,7 @@ def test_onOffset(self, case):
33963396

33973397

33983398
class TestSemiMonthEnd(Base):
3399-
_offset = SemiMonthEnd
3399+
_offset = SemiMonthEnd # type: Callable
34003400
offset1 = _offset()
34013401
offset2 = _offset(2)
34023402

@@ -3655,7 +3655,7 @@ def test_vectorized_offset_addition(self, klass):
36553655

36563656

36573657
class TestSemiMonthBegin(Base):
3658-
_offset = SemiMonthBegin
3658+
_offset = SemiMonthBegin # type: Callable
36593659
offset1 = _offset()
36603660
offset2 = _offset(2)
36613661

setup.cfg

-3
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,6 @@ ignore_errors=True
226226
[mypy-pandas.tests.test_base]
227227
ignore_errors=True
228228

229-
[mypy-pandas.tests.tseries.offsets.test_offsets]
230-
ignore_errors=True
231-
232229
[mypy-pandas.tests.tseries.offsets.test_offsets_properties]
233230
ignore_errors=True
234231

0 commit comments

Comments
 (0)