Skip to content

Commit 904e07f

Browse files
committed
Fix mypy error messages in pandas/test/tseries/offsets/test_offsets.py
Fix import order
1 parent 86e187f commit 904e07f

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

pandas/tests/tseries/offsets/test_offsets.py

+13-12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from datetime import date, datetime, time as dt_time, timedelta
2+
from typing import Callable, Dict, List, Tuple, Union
23

34
import numpy as np
45
import pytest
@@ -92,7 +93,7 @@ def test_to_M8():
9293

9394

9495
class Base:
95-
_offset = None
96+
_offset = None # type: Union[BusinessHour, CustomBusinessHour, Callable]
9697
d = Timestamp(datetime(2008, 1, 2))
9798

9899
timezones = [
@@ -659,7 +660,7 @@ def test_eq(self):
659660

660661

661662
class TestBusinessDay(Base):
662-
_offset = BDay
663+
_offset = BDay # type: Callable
663664

664665
def setup_method(self, method):
665666
self.d = datetime(2008, 1, 1)
@@ -740,7 +741,7 @@ def test_onOffset(self):
740741
for offset, d, expected in tests:
741742
assert_onOffset(offset, d, expected)
742743

743-
apply_cases = []
744+
apply_cases = [] # type: List[Tuple[int, Dict[datetime, datetime]]]
744745
apply_cases.append(
745746
(
746747
BDay(),
@@ -1697,7 +1698,7 @@ def test_opening_time(self, case):
16971698
assert offset._next_opening_time(dt) == exp_next
16981699
assert offset._prev_opening_time(dt) == exp_prev
16991700

1700-
apply_cases = []
1701+
apply_cases = [] # type: List[Tuple[int, Dict[datetime, datetime]]]
17011702
apply_cases.append(
17021703
(
17031704
BusinessHour(),
@@ -2631,7 +2632,7 @@ def test_onOffset(self, case):
26312632
apply_cases = []
26322633
apply_cases.append(
26332634
(
2634-
CDay(),
2635+
1 * CDay(),
26352636
{
26362637
datetime(2008, 1, 1): datetime(2008, 1, 2),
26372638
datetime(2008, 1, 4): datetime(2008, 1, 7),
@@ -2878,7 +2879,7 @@ def test_onOffset(self, case):
28782879
apply_cases = []
28792880
apply_cases.append(
28802881
(
2881-
CBMonthEnd(),
2882+
1 * CBMonthEnd(),
28822883
{
28832884
datetime(2008, 1, 1): datetime(2008, 1, 31),
28842885
datetime(2008, 2, 7): datetime(2008, 2, 29),
@@ -3027,7 +3028,7 @@ def test_onOffset(self, case):
30273028
apply_cases = []
30283029
apply_cases.append(
30293030
(
3030-
CBMonthBegin(),
3031+
1 * CBMonthBegin(),
30313032
{
30323033
datetime(2008, 1, 1): datetime(2008, 2, 1),
30333034
datetime(2008, 2, 7): datetime(2008, 3, 3),
@@ -3120,7 +3121,7 @@ def test_datetimeindex(self):
31203121

31213122

31223123
class TestWeek(Base):
3123-
_offset = Week
3124+
_offset = Week # type: Callable
31243125
d = Timestamp(datetime(2008, 1, 2))
31253126
offset1 = _offset()
31263127
offset2 = _offset(2)
@@ -3219,7 +3220,7 @@ def test_onOffset(self, weekday):
32193220

32203221

32213222
class TestWeekOfMonth(Base):
3222-
_offset = WeekOfMonth
3223+
_offset = WeekOfMonth # type: Callable
32233224
offset1 = _offset()
32243225
offset2 = _offset(2)
32253226

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

33203321

33213322
class TestLastWeekOfMonth(Base):
3322-
_offset = LastWeekOfMonth
3323+
_offset = LastWeekOfMonth # type: Callable
33233324
offset1 = _offset()
33243325
offset2 = _offset(2)
33253326

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

33973398

33983399
class TestSemiMonthEnd(Base):
3399-
_offset = SemiMonthEnd
3400+
_offset = SemiMonthEnd # type: Callable
34003401
offset1 = _offset()
34013402
offset2 = _offset(2)
34023403

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

36563657

36573658
class TestSemiMonthBegin(Base):
3658-
_offset = SemiMonthBegin
3659+
_offset = SemiMonthBegin # type: Callable
36593660
offset1 = _offset()
36603661
offset2 = _offset(2)
36613662

setup.cfg

-3
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,5 @@ ignore_errors=True
217217
[mypy-pandas.tests.test_base]
218218
ignore_errors=True
219219

220-
[mypy-pandas.tests.tseries.offsets.test_offsets]
221-
ignore_errors=True
222-
223220
[mypy-pandas.tests.tseries.offsets.test_yqm_offsets]
224221
ignore_errors=True

0 commit comments

Comments
 (0)