@@ -150,10 +150,10 @@ def test_different_normalize_equals(self):
150
150
self .assertEqual (offset , offset2 )
151
151
152
152
def test_repr (self ):
153
- assert repr (self .offset ) == '<1 BusinessDay>'
154
- assert repr (self .offset2 ) == '<2 BusinessDays>'
153
+ self . assertEqual ( repr (self .offset ), '< BusinessDay>')
154
+ assert repr (self .offset2 ) == '<2 * BusinessDays>'
155
155
156
- expected = '<1 BusinessDay: offset=datetime.timedelta(1)>'
156
+ expected = '<BusinessDay: offset=datetime.timedelta(1)>'
157
157
assert repr (self .offset + timedelta (1 )) == expected
158
158
159
159
def test_with_offset (self ):
@@ -324,10 +324,10 @@ def test_different_normalize_equals(self):
324
324
self .assertEqual (offset , offset2 )
325
325
326
326
def test_repr (self ):
327
- assert repr (self .offset ) == '<1 CustomBusinessDay>'
328
- assert repr (self .offset2 ) == '<2 CustomBusinessDays>'
327
+ assert repr (self .offset ) == '<CustomBusinessDay>'
328
+ assert repr (self .offset2 ) == '<2 * CustomBusinessDays>'
329
329
330
- expected = '<1 BusinessDay: offset=datetime.timedelta(1)>'
330
+ expected = '<BusinessDay: offset=datetime.timedelta(1)>'
331
331
assert repr (self .offset + timedelta (1 )) == expected
332
332
333
333
def test_with_offset (self ):
@@ -526,6 +526,11 @@ def assertOnOffset(offset, date, expected):
526
526
527
527
528
528
class TestWeek (unittest .TestCase ):
529
+ def test_repr (self ):
530
+ self .assertEqual (repr (Week (weekday = 0 )), "<Week: weekday=0>" )
531
+ self .assertEqual (repr (Week (n = - 1 , weekday = 0 )), "<-1 * Week: weekday=0>" )
532
+ self .assertEqual (repr (Week (n = - 2 , weekday = 0 )), "<-2 * Weeks: weekday=0>" )
533
+
529
534
def test_corner (self ):
530
535
self .assertRaises (ValueError , Week , weekday = 7 )
531
536
assertRaisesRegexp (ValueError , "Day must be" , Week , weekday = - 1 )
@@ -598,6 +603,9 @@ def test_constructor(self):
598
603
assertRaisesRegexp (ValueError , "^Day" , WeekOfMonth , n = 1 , week = 0 , weekday = - 1 )
599
604
assertRaisesRegexp (ValueError , "^Day" , WeekOfMonth , n = 1 , week = 0 , weekday = 7 )
600
605
606
+ def test_repr (self ):
607
+ self .assertEqual (repr (WeekOfMonth (weekday = 1 ,week = 2 )), "<WeekOfMonth: week=2, weekday=1>" )
608
+
601
609
def test_offset (self ):
602
610
date1 = datetime (2011 , 1 , 4 ) # 1st Tuesday of Month
603
611
date2 = datetime (2011 , 1 , 11 ) # 2nd Tuesday of Month
@@ -895,6 +903,11 @@ def test_onOffset(self):
895
903
896
904
897
905
class TestBQuarterBegin (unittest .TestCase ):
906
+
907
+ def test_repr (self ):
908
+ self .assertEqual (repr (BQuarterBegin ()),"<BusinessQuarterBegin: startingMonth=3>" )
909
+ self .assertEqual (repr (BQuarterBegin (startingMonth = 3 )), "<BusinessQuarterBegin: startingMonth=3>" )
910
+ self .assertEqual (repr (BQuarterBegin (startingMonth = 1 )), "<BusinessQuarterBegin: startingMonth=1>" )
898
911
899
912
def test_isAnchored (self ):
900
913
self .assert_ (BQuarterBegin (startingMonth = 1 ).isAnchored ())
@@ -981,6 +994,11 @@ def test_offset(self):
981
994
982
995
class TestBQuarterEnd (unittest .TestCase ):
983
996
997
+ def test_repr (self ):
998
+ self .assertEqual (repr (BQuarterEnd ()),"<BusinessQuarterEnd: startingMonth=3>" )
999
+ self .assertEqual (repr (BQuarterEnd (startingMonth = 3 )), "<BusinessQuarterEnd: startingMonth=3>" )
1000
+ self .assertEqual (repr (BQuarterEnd (startingMonth = 1 )), "<BusinessQuarterEnd: startingMonth=1>" )
1001
+
984
1002
def test_isAnchored (self ):
985
1003
self .assert_ (BQuarterEnd (startingMonth = 1 ).isAnchored ())
986
1004
self .assert_ (BQuarterEnd ().isAnchored ())
@@ -1083,6 +1101,11 @@ def test_onOffset(self):
1083
1101
1084
1102
1085
1103
class TestQuarterBegin (unittest .TestCase ):
1104
+ def test_repr (self ):
1105
+ self .assertEqual (repr (QuarterBegin ()), "<QuarterBegin: startingMonth=3>" )
1106
+ self .assertEqual (repr (QuarterBegin (startingMonth = 3 )), "<QuarterBegin: startingMonth=3>" )
1107
+ self .assertEqual (repr (QuarterBegin (startingMonth = 1 )),"<QuarterBegin: startingMonth=1>" )
1108
+
1086
1109
def test_isAnchored (self ):
1087
1110
self .assert_ (QuarterBegin (startingMonth = 1 ).isAnchored ())
1088
1111
self .assert_ (QuarterBegin ().isAnchored ())
@@ -1152,7 +1175,11 @@ def test_offset(self):
1152
1175
1153
1176
1154
1177
class TestQuarterEnd (unittest .TestCase ):
1155
-
1178
+ def test_repr (self ):
1179
+ self .assertEqual (repr (QuarterEnd ()), "<QuarterEnd: startingMonth=3>" )
1180
+ self .assertEqual (repr (QuarterEnd (startingMonth = 3 )), "<QuarterEnd: startingMonth=3>" )
1181
+ self .assertEqual (repr (QuarterEnd (startingMonth = 1 )), "<QuarterEnd: startingMonth=1>" )
1182
+
1156
1183
def test_isAnchored (self ):
1157
1184
self .assert_ (QuarterEnd (startingMonth = 1 ).isAnchored ())
1158
1185
self .assert_ (QuarterEnd ().isAnchored ())
0 commit comments