@@ -97,7 +97,7 @@ def test_to_m8():
97
97
### DateOffset Tests
98
98
#####
99
99
100
- class TestBase (tm .TestCase ):
100
+ class Base (tm .TestCase ):
101
101
_offset = None
102
102
103
103
offset_types = [getattr (offsets , o ) for o in offsets .__all__ ]
@@ -119,8 +119,8 @@ def _get_offset(self, klass, value=1):
119
119
120
120
def test_apply_out_of_range (self ):
121
121
if self ._offset is None :
122
- raise nose . SkipTest ( "_offset not defined to test out-of-range" )
123
- if self ._offset in self .skip_np_u1p7 :
122
+ return
123
+ if _np_version_under1p7 and self ._offset in self .skip_np_u1p7 :
124
124
raise nose .SkipTest ('numpy >= 1.7 required' )
125
125
126
126
# try to create an out-of-bounds result timestamp; if we can't create the offset
@@ -132,11 +132,11 @@ def test_apply_out_of_range(self):
132
132
self .assertIsInstance (result , datetime )
133
133
except (OutOfBoundsDatetime ):
134
134
raise
135
- except (ValueError , KeyError ):
136
- raise nose .SkipTest ("cannot create out_of_range offset" )
135
+ except (ValueError , KeyError ) as e :
136
+ raise nose .SkipTest ("cannot create out_of_range offset: {0} {1}" . format ( str ( self ). split ( '.' )[ - 1 ], e ) )
137
137
138
138
139
- class TestOps (TestBase ):
139
+ class TestOps (Base ):
140
140
141
141
def test_return_type (self ):
142
142
for offset in self .offset_types :
@@ -157,7 +157,7 @@ def test_return_type(self):
157
157
self .assert_ ((- offset ).apply (NaT ) is NaT )
158
158
159
159
160
- class TestDateOffset (TestBase ):
160
+ class TestDateOffset (Base ):
161
161
_multiprocess_can_split_ = True
162
162
163
163
def setUp (self ):
@@ -197,7 +197,7 @@ def test_eq(self):
197
197
self .assertNotEqual (offset1 , offset2 )
198
198
199
199
200
- class TestBusinessDay (TestBase ):
200
+ class TestBusinessDay (Base ):
201
201
_multiprocess_can_split_ = True
202
202
_offset = BDay
203
203
@@ -376,7 +376,7 @@ def test_offsets_compare_equal(self):
376
376
self .assertFalse (offset1 != offset2 )
377
377
378
378
379
- class TestCustomBusinessDay (TestBase ):
379
+ class TestCustomBusinessDay (Base ):
380
380
_multiprocess_can_split_ = True
381
381
_offset = CDay
382
382
@@ -641,7 +641,7 @@ def test_offsets_compare_equal(self):
641
641
offset2 = self ._object ()
642
642
self .assertFalse (offset1 != offset2 )
643
643
644
- class TestCustomBusinessMonthEnd (CustomBusinessMonthBase , TestBase ):
644
+ class TestCustomBusinessMonthEnd (CustomBusinessMonthBase , Base ):
645
645
_object = CBMonthEnd
646
646
647
647
def test_different_normalize_equals (self ):
@@ -756,7 +756,7 @@ def test_datetimeindex(self):
756
756
self .assertEqual (DatetimeIndex (start = '20120101' ,end = '20130101' ,freq = CBMonthEnd (calendar = USFederalHolidayCalendar ())).tolist ()[0 ],
757
757
datetime (2012 ,1 ,31 ))
758
758
759
- class TestCustomBusinessMonthBegin (CustomBusinessMonthBase , TestBase ):
759
+ class TestCustomBusinessMonthBegin (CustomBusinessMonthBase , Base ):
760
760
_object = CBMonthBegin
761
761
762
762
def test_different_normalize_equals (self ):
@@ -878,7 +878,7 @@ def assertOnOffset(offset, date, expected):
878
878
(expected , actual , offset , date ))
879
879
880
880
881
- class TestWeek (TestBase ):
881
+ class TestWeek (Base ):
882
882
_offset = Week
883
883
884
884
def test_repr (self ):
@@ -949,7 +949,7 @@ def test_offsets_compare_equal(self):
949
949
self .assertFalse (offset1 != offset2 )
950
950
951
951
952
- class TestWeekOfMonth (TestBase ):
952
+ class TestWeekOfMonth (Base ):
953
953
_offset = WeekOfMonth
954
954
955
955
def test_constructor (self ):
@@ -1028,7 +1028,7 @@ def test_onOffset(self):
1028
1028
offset = WeekOfMonth (week = week , weekday = weekday )
1029
1029
self .assertEqual (offset .onOffset (date ), expected )
1030
1030
1031
- class TestLastWeekOfMonth (TestBase ):
1031
+ class TestLastWeekOfMonth (Base ):
1032
1032
_offset = LastWeekOfMonth
1033
1033
1034
1034
def test_constructor (self ):
@@ -1100,7 +1100,7 @@ def test_onOffset(self):
1100
1100
self .assertEqual (offset .onOffset (date ), expected , msg = date )
1101
1101
1102
1102
1103
- class TestBMonthBegin (TestBase ):
1103
+ class TestBMonthBegin (Base ):
1104
1104
_offset = BMonthBegin
1105
1105
1106
1106
def test_offset (self ):
@@ -1162,7 +1162,7 @@ def test_offsets_compare_equal(self):
1162
1162
self .assertFalse (offset1 != offset2 )
1163
1163
1164
1164
1165
- class TestBMonthEnd (TestBase ):
1165
+ class TestBMonthEnd (Base ):
1166
1166
_offset = BMonthEnd
1167
1167
1168
1168
def test_offset (self ):
@@ -1225,7 +1225,7 @@ def test_offsets_compare_equal(self):
1225
1225
self .assertFalse (offset1 != offset2 )
1226
1226
1227
1227
1228
- class TestMonthBegin (TestBase ):
1228
+ class TestMonthBegin (Base ):
1229
1229
_offset = MonthBegin
1230
1230
1231
1231
def test_offset (self ):
@@ -1266,7 +1266,7 @@ def test_offset(self):
1266
1266
assertEq (offset , base , expected )
1267
1267
1268
1268
1269
- class TestMonthEnd (TestBase ):
1269
+ class TestMonthEnd (Base ):
1270
1270
_offset = MonthEnd
1271
1271
1272
1272
def test_offset (self ):
@@ -1334,7 +1334,7 @@ def test_onOffset(self):
1334
1334
assertOnOffset (offset , date , expected )
1335
1335
1336
1336
1337
- class TestBQuarterBegin (TestBase ):
1337
+ class TestBQuarterBegin (Base ):
1338
1338
_offset = BQuarterBegin
1339
1339
1340
1340
def test_repr (self ):
@@ -1425,7 +1425,7 @@ def test_offset(self):
1425
1425
self .assertEqual (datetime (2007 , 4 , 3 ) + offset , datetime (2007 , 4 , 2 ))
1426
1426
1427
1427
1428
- class TestBQuarterEnd (TestBase ):
1428
+ class TestBQuarterEnd (Base ):
1429
1429
_offset = BQuarterEnd
1430
1430
1431
1431
def test_repr (self ):
@@ -1545,7 +1545,7 @@ def makeFY5253NearestEndMonth(*args, **kwds):
1545
1545
def makeFY5253LastOfMonth (* args , ** kwds ):
1546
1546
return FY5253 (* args , variation = "last" , ** kwds )
1547
1547
1548
- class TestFY5253LastOfMonth (TestBase ):
1548
+ class TestFY5253LastOfMonth (Base ):
1549
1549
1550
1550
def test_onOffset (self ):
1551
1551
@@ -1619,7 +1619,7 @@ def test_apply(self):
1619
1619
current = current + offset
1620
1620
self .assertEqual (current , datum )
1621
1621
1622
- class TestFY5253NearestEndMonth (TestBase ):
1622
+ class TestFY5253NearestEndMonth (Base ):
1623
1623
1624
1624
def test_get_target_month_end (self ):
1625
1625
self .assertEqual (makeFY5253NearestEndMonth (startingMonth = 8 , weekday = WeekDay .SAT ).get_target_month_end (datetime (2013 ,1 ,1 )), datetime (2013 ,8 ,31 ))
@@ -1737,7 +1737,7 @@ def test_apply(self):
1737
1737
current = current + offset
1738
1738
self .assertEqual (current , datum )
1739
1739
1740
- class TestFY5253LastOfMonthQuarter (TestBase ):
1740
+ class TestFY5253LastOfMonthQuarter (Base ):
1741
1741
1742
1742
def test_isAnchored (self ):
1743
1743
self .assert_ (makeFY5253LastOfMonthQuarter (startingMonth = 1 , weekday = WeekDay .SAT , qtr_with_extra_week = 4 ).isAnchored ())
@@ -1879,7 +1879,7 @@ def test_get_weeks(self):
1879
1879
self .assertEqual (sat_dec_4 .get_weeks (datetime (2011 , 4 , 2 )), [13 , 13 , 13 , 14 ])
1880
1880
self .assertEqual (sat_dec_1 .get_weeks (datetime (2010 , 12 , 25 )), [13 , 13 , 13 , 13 ])
1881
1881
1882
- class TestFY5253NearestEndMonthQuarter (TestBase ):
1882
+ class TestFY5253NearestEndMonthQuarter (Base ):
1883
1883
1884
1884
def test_onOffset (self ):
1885
1885
@@ -1955,7 +1955,7 @@ def test_offset(self):
1955
1955
1956
1956
assertEq (offset2 , datetime (2013 ,1 ,15 ), datetime (2013 , 3 , 30 ))
1957
1957
1958
- class TestQuarterBegin (TestBase ):
1958
+ class TestQuarterBegin (Base ):
1959
1959
1960
1960
def test_repr (self ):
1961
1961
self .assertEqual (repr (QuarterBegin ()), "<QuarterBegin: startingMonth=3>" )
@@ -2030,7 +2030,7 @@ def test_offset(self):
2030
2030
self .assertEqual (datetime (2010 , 2 , 1 ) + offset , datetime (2010 , 1 , 1 ))
2031
2031
2032
2032
2033
- class TestQuarterEnd (TestBase ):
2033
+ class TestQuarterEnd (Base ):
2034
2034
_offset = QuarterEnd
2035
2035
2036
2036
def test_repr (self ):
@@ -2168,7 +2168,7 @@ def test_onOffset(self):
2168
2168
assertOnOffset (offset , date , expected )
2169
2169
2170
2170
2171
- class TestBYearBegin (TestBase ):
2171
+ class TestBYearBegin (Base ):
2172
2172
_offset = BYearBegin
2173
2173
2174
2174
def test_misspecified (self ):
@@ -2216,7 +2216,7 @@ def test_offset(self):
2216
2216
assertEq (offset , base , expected )
2217
2217
2218
2218
2219
- class TestYearBegin (TestBase ):
2219
+ class TestYearBegin (Base ):
2220
2220
_offset = YearBegin
2221
2221
2222
2222
def test_misspecified (self ):
@@ -2289,7 +2289,7 @@ def test_onOffset(self):
2289
2289
assertOnOffset (offset , date , expected )
2290
2290
2291
2291
2292
- class TestBYearEndLagged (TestBase ):
2292
+ class TestBYearEndLagged (Base ):
2293
2293
2294
2294
def test_bad_month_fail (self ):
2295
2295
self .assertRaises (Exception , BYearEnd , month = 13 )
@@ -2330,7 +2330,7 @@ def test_onOffset(self):
2330
2330
assertOnOffset (offset , date , expected )
2331
2331
2332
2332
2333
- class TestBYearEnd (TestBase ):
2333
+ class TestBYearEnd (Base ):
2334
2334
_offset = BYearEnd
2335
2335
2336
2336
def test_offset (self ):
@@ -2379,7 +2379,7 @@ def test_onOffset(self):
2379
2379
assertOnOffset (offset , date , expected )
2380
2380
2381
2381
2382
- class TestYearEnd (TestBase ):
2382
+ class TestYearEnd (Base ):
2383
2383
_offset = YearEnd
2384
2384
2385
2385
def test_misspecified (self ):
@@ -2431,7 +2431,7 @@ def test_onOffset(self):
2431
2431
assertOnOffset (offset , date , expected )
2432
2432
2433
2433
2434
- class TestYearEndDiffMonth (TestBase ):
2434
+ class TestYearEndDiffMonth (Base ):
2435
2435
2436
2436
def test_offset (self ):
2437
2437
tests = []
0 commit comments