@@ -26,12 +26,10 @@ def test_is_holiday(self):
2626 self .assertTrue (d .is_holiday (datetime .date (2017 , 12 , 25 )))
2727 self .assertFalse (d .is_holiday (datetime .date (2017 , 12 , 1 )))
2828
29- with self .assertRaisesRegexp (
30- UnsupportedYearException , "No data for year: 1985"
31- ):
29+ with self .assertRaisesRegex (UnsupportedYearException , "No data for year: 1985" ):
3230 d .is_holiday (datetime .date (1985 , 2 , 7 ))
3331
34- with self .assertRaisesRegexp (ValueError , "date should be a datetime.date" ):
32+ with self .assertRaisesRegex (ValueError , "date should be a datetime.date" ):
3533 d .is_holiday (datetime .datetime (2017 , 12 , 1 , 2 , 0 ))
3634
3735 def test_is_holiday_for_zone (self ):
@@ -43,38 +41,34 @@ def test_is_holiday_for_zone(self):
4341 self .assertFalse (d .is_holiday_for_zone (datetime .date (2009 , 3 , 7 ), "A" ))
4442 self .assertFalse (d .is_holiday_for_zone (datetime .date (2009 , 6 , 7 ), "A" ))
4543
46- with self .assertRaisesRegexp (
47- UnsupportedYearException , "No data for year: 1985"
48- ):
44+ with self .assertRaisesRegex (UnsupportedYearException , "No data for year: 1985" ):
4945 d .is_holiday_for_zone (datetime .date (1985 , 2 , 7 ), "D" )
50- with self .assertRaisesRegexp (UnsupportedZoneException , "Unsupported zone: D" ):
46+ with self .assertRaisesRegex (UnsupportedZoneException , "Unsupported zone: D" ):
5147 self .assertFalse (d .is_holiday_for_zone (datetime .date (2009 , 2 , 7 ), "D" ))
52- with self .assertRaisesRegexp (ValueError , "date should be a datetime.date" ):
48+ with self .assertRaisesRegex (ValueError , "date should be a datetime.date" ):
5349 d .is_holiday_for_zone (datetime .datetime (2017 , 12 , 1 , 2 , 0 ), "A" )
5450
5551 def test_holidays_for_year (self ):
5652 d = SchoolHolidayDates ()
5753
5854 res = d .holidays_for_year (2018 )
5955
60- self .assertEquals (len (res ), 151 )
56+ self .assertEqual (len (res ), 151 )
6157
6258 for k , v in res .items ():
63- self .assertEquals (sorted (v .keys ()), self .EXPECTED_KEYS )
59+ self .assertEqual (sorted (v .keys ()), self .EXPECTED_KEYS )
6460
65- with self .assertRaisesRegexp (
66- UnsupportedYearException , "No data for year: 2027"
67- ):
68- self .assertEquals ({}, d .holidays_for_year (2027 ))
61+ with self .assertRaisesRegex (UnsupportedYearException , "No data for year: 2027" ):
62+ self .assertEqual ({}, d .holidays_for_year (2027 ))
6963
7064 def test_holiday_for_year_by_name (self ):
7165 d = SchoolHolidayDates ()
7266
7367 res = d .holiday_for_year_by_name (2017 , "Vacances de la Toussaint" )
7468
75- self .assertEquals (len (res ), 16 )
69+ self .assertEqual (len (res ), 16 )
7670 for k , v in res .items ():
77- self .assertEquals (sorted (v .keys ()), self .EXPECTED_KEYS )
71+ self .assertEqual (sorted (v .keys ()), self .EXPECTED_KEYS )
7872 expected_dates = [
7973 self .parse_date (date )
8074 for date in [
@@ -96,47 +90,43 @@ def test_holiday_for_year_by_name(self):
9690 "2017-11-05" ,
9791 ]
9892 ]
99- self .assertEquals (sorted ([v ["date" ] for v in res .values ()]), expected_dates )
93+ self .assertEqual (sorted ([v ["date" ] for v in res .values ()]), expected_dates )
10094
101- with self .assertRaisesRegexp (
102- UnsupportedYearException , "No data for year: 1985"
103- ):
104- self .assertEquals (
95+ with self .assertRaisesRegex (UnsupportedYearException , "No data for year: 1985" ):
96+ self .assertEqual (
10597 {}, d .holiday_for_year_by_name (1985 , "Vacances de la Toussaint" )
10698 )
10799
108- with self .assertRaisesRegexp (
100+ with self .assertRaisesRegex (
109101 UnsupportedHolidayException , "Unknown holiday name: Foo"
110102 ):
111- self .assertEquals ({}, d .holiday_for_year_by_name (2017 , "Foo" ))
103+ self .assertEqual ({}, d .holiday_for_year_by_name (2017 , "Foo" ))
112104
113105 def test_holidays_for_year_and_zone (self ):
114106 d = SchoolHolidayDates ()
115107
116108 res = d .holidays_for_year_and_zone (2017 , "A" )
117109
118- self .assertEquals (len (res ), 118 )
110+ self .assertEqual (len (res ), 118 )
119111 for k , v in res .items ():
120- self .assertEquals (sorted (v .keys ()), self .EXPECTED_KEYS )
112+ self .assertEqual (sorted (v .keys ()), self .EXPECTED_KEYS )
121113
122114 self .assertTrue (v ["vacances_zone_a" ])
123115
124- with self .assertRaisesRegexp (
125- UnsupportedYearException , "No data for year: 1985"
126- ):
116+ with self .assertRaisesRegex (UnsupportedYearException , "No data for year: 1985" ):
127117 self .assertFalse (d .holidays_for_year_and_zone (1985 , "D" ))
128118
129- with self .assertRaisesRegexp (UnsupportedZoneException , "Unsupported zone: D" ):
119+ with self .assertRaisesRegex (UnsupportedZoneException , "Unsupported zone: D" ):
130120 self .assertFalse (d .holidays_for_year_and_zone (2017 , "D" ))
131121
132122 def test_holidays_for_year_zone_and_name (self ):
133123 d = SchoolHolidayDates ()
134124
135125 res = d .holidays_for_year_zone_and_name (2017 , "A" , "Vacances de printemps" )
136- self .assertEquals (len (res ), 17 )
126+ self .assertEqual (len (res ), 17 )
137127
138128 for k , v in res .items ():
139- self .assertEquals (sorted (v .keys ()), self .EXPECTED_KEYS )
129+ self .assertEqual (sorted (v .keys ()), self .EXPECTED_KEYS )
140130 expected_dates = [
141131 self .parse_date (date )
142132 for date in [
@@ -159,17 +149,15 @@ def test_holidays_for_year_zone_and_name(self):
159149 "2017-05-01" ,
160150 ]
161151 ]
162- self .assertEquals (sorted ([v ["date" ] for v in res .values ()]), expected_dates )
152+ self .assertEqual (sorted ([v ["date" ] for v in res .values ()]), expected_dates )
163153
164- with self .assertRaisesRegexp (
165- UnsupportedYearException , "No data for year: 1985"
166- ):
154+ with self .assertRaisesRegex (UnsupportedYearException , "No data for year: 1985" ):
167155 d .holidays_for_year_zone_and_name (1985 , "A" , "Vacances de printemps" )
168156
169- with self .assertRaisesRegexp (UnsupportedZoneException , "Unsupported zone: D" ):
157+ with self .assertRaisesRegex (UnsupportedZoneException , "Unsupported zone: D" ):
170158 d .holidays_for_year_zone_and_name (2017 , "D" , "Vacances de printemps" )
171159
172- with self .assertRaisesRegexp (
160+ with self .assertRaisesRegex (
173161 UnsupportedHolidayException , "Unknown holiday name: Foo"
174162 ):
175163 d .holidays_for_year_zone_and_name (2017 , "A" , "Foo" )
@@ -184,4 +172,4 @@ def test_supported_holidays_are_complete(self):
184172 names .add (v ["nom_vacances" ])
185173
186174 expected = set (SchoolHolidayDates .SUPPORTED_HOLIDAY_NAMES )
187- self .assertEquals (names , expected )
175+ self .assertEqual (names , expected )
0 commit comments