|
1 | 1 | from datetime import date, datetime, time as dt_time, timedelta
|
| 2 | +from typing import Callable, Dict, List, Tuple, Union |
2 | 3 |
|
3 | 4 | import numpy as np
|
4 | 5 | import pytest
|
@@ -92,7 +93,7 @@ def test_to_M8():
|
92 | 93 |
|
93 | 94 |
|
94 | 95 | class Base:
|
95 |
| - _offset = None |
| 96 | + _offset = None # type: Union[BusinessHour, CustomBusinessHour, Callable] |
96 | 97 | d = Timestamp(datetime(2008, 1, 2))
|
97 | 98 |
|
98 | 99 | timezones = [
|
@@ -659,7 +660,7 @@ def test_eq(self):
|
659 | 660 |
|
660 | 661 |
|
661 | 662 | class TestBusinessDay(Base):
|
662 |
| - _offset = BDay |
| 663 | + _offset = BDay # type: Callable |
663 | 664 |
|
664 | 665 | def setup_method(self, method):
|
665 | 666 | self.d = datetime(2008, 1, 1)
|
@@ -740,7 +741,7 @@ def test_onOffset(self):
|
740 | 741 | for offset, d, expected in tests:
|
741 | 742 | assert_onOffset(offset, d, expected)
|
742 | 743 |
|
743 |
| - apply_cases = [] |
| 744 | + apply_cases = [] # type: List[Tuple[int, Dict[datetime, datetime]]] |
744 | 745 | apply_cases.append(
|
745 | 746 | (
|
746 | 747 | BDay(),
|
@@ -1697,7 +1698,7 @@ def test_opening_time(self, case):
|
1697 | 1698 | assert offset._next_opening_time(dt) == exp_next
|
1698 | 1699 | assert offset._prev_opening_time(dt) == exp_prev
|
1699 | 1700 |
|
1700 |
| - apply_cases = [] |
| 1701 | + apply_cases = [] # type: List[Tuple[int, Dict[datetime, datetime]]] |
1701 | 1702 | apply_cases.append(
|
1702 | 1703 | (
|
1703 | 1704 | BusinessHour(),
|
@@ -2631,7 +2632,7 @@ def test_onOffset(self, case):
|
2631 | 2632 | apply_cases = []
|
2632 | 2633 | apply_cases.append(
|
2633 | 2634 | (
|
2634 |
| - CDay(), |
| 2635 | + 1 * CDay(), |
2635 | 2636 | {
|
2636 | 2637 | datetime(2008, 1, 1): datetime(2008, 1, 2),
|
2637 | 2638 | datetime(2008, 1, 4): datetime(2008, 1, 7),
|
@@ -2878,7 +2879,7 @@ def test_onOffset(self, case):
|
2878 | 2879 | apply_cases = []
|
2879 | 2880 | apply_cases.append(
|
2880 | 2881 | (
|
2881 |
| - CBMonthEnd(), |
| 2882 | + 1 * CBMonthEnd(), |
2882 | 2883 | {
|
2883 | 2884 | datetime(2008, 1, 1): datetime(2008, 1, 31),
|
2884 | 2885 | datetime(2008, 2, 7): datetime(2008, 2, 29),
|
@@ -3027,7 +3028,7 @@ def test_onOffset(self, case):
|
3027 | 3028 | apply_cases = []
|
3028 | 3029 | apply_cases.append(
|
3029 | 3030 | (
|
3030 |
| - CBMonthBegin(), |
| 3031 | + 1 * CBMonthBegin(), |
3031 | 3032 | {
|
3032 | 3033 | datetime(2008, 1, 1): datetime(2008, 2, 1),
|
3033 | 3034 | datetime(2008, 2, 7): datetime(2008, 3, 3),
|
@@ -3120,7 +3121,7 @@ def test_datetimeindex(self):
|
3120 | 3121 |
|
3121 | 3122 |
|
3122 | 3123 | class TestWeek(Base):
|
3123 |
| - _offset = Week |
| 3124 | + _offset = Week # type: Callable |
3124 | 3125 | d = Timestamp(datetime(2008, 1, 2))
|
3125 | 3126 | offset1 = _offset()
|
3126 | 3127 | offset2 = _offset(2)
|
@@ -3219,7 +3220,7 @@ def test_onOffset(self, weekday):
|
3219 | 3220 |
|
3220 | 3221 |
|
3221 | 3222 | class TestWeekOfMonth(Base):
|
3222 |
| - _offset = WeekOfMonth |
| 3223 | + _offset = WeekOfMonth # type: Callable |
3223 | 3224 | offset1 = _offset()
|
3224 | 3225 | offset2 = _offset(2)
|
3225 | 3226 |
|
@@ -3319,7 +3320,7 @@ def test_onOffset(self, case):
|
3319 | 3320 |
|
3320 | 3321 |
|
3321 | 3322 | class TestLastWeekOfMonth(Base):
|
3322 |
| - _offset = LastWeekOfMonth |
| 3323 | + _offset = LastWeekOfMonth # type: Callable |
3323 | 3324 | offset1 = _offset()
|
3324 | 3325 | offset2 = _offset(2)
|
3325 | 3326 |
|
@@ -3396,7 +3397,7 @@ def test_onOffset(self, case):
|
3396 | 3397 |
|
3397 | 3398 |
|
3398 | 3399 | class TestSemiMonthEnd(Base):
|
3399 |
| - _offset = SemiMonthEnd |
| 3400 | + _offset = SemiMonthEnd # type: Callable |
3400 | 3401 | offset1 = _offset()
|
3401 | 3402 | offset2 = _offset(2)
|
3402 | 3403 |
|
@@ -3655,7 +3656,7 @@ def test_vectorized_offset_addition(self, klass):
|
3655 | 3656 |
|
3656 | 3657 |
|
3657 | 3658 | class TestSemiMonthBegin(Base):
|
3658 |
| - _offset = SemiMonthBegin |
| 3659 | + _offset = SemiMonthBegin # type: Callable |
3659 | 3660 | offset1 = _offset()
|
3660 | 3661 | offset2 = _offset(2)
|
3661 | 3662 |
|
|
0 commit comments