@@ -148,7 +148,8 @@ def test_union_misc(self, sort):
148148 # raise if different frequencies
149149 index = period_range ("1/1/2000" , "1/20/2000" , freq = "D" )
150150 index2 = period_range ("1/1/2000" , "1/20/2000" , freq = "W-WED" )
151- with pytest .raises (IncompatibleFrequency ):
151+ msg = r"Input has different freq=W-WED from PeriodIndex\(freq=D\)"
152+ with pytest .raises (IncompatibleFrequency , match = msg ):
152153 index .union (index2 , sort = sort )
153154
154155 # TODO: belongs elsewhere
@@ -180,11 +181,13 @@ def test_intersection(self, sort):
180181 # raise if different frequencies
181182 index = period_range ("1/1/2000" , "1/20/2000" , freq = "D" )
182183 index2 = period_range ("1/1/2000" , "1/20/2000" , freq = "W-WED" )
183- with pytest .raises (IncompatibleFrequency ):
184+ msg = r"Input has different freq=W-WED from PeriodIndex\(freq=D\)"
185+ with pytest .raises (IncompatibleFrequency , match = msg ):
184186 index .intersection (index2 , sort = sort )
185187
186188 index3 = period_range ("1/1/2000" , "1/20/2000" , freq = "2D" )
187- with pytest .raises (IncompatibleFrequency ):
189+ msg = r"Input has different freq=2D from PeriodIndex\(freq=D\)"
190+ with pytest .raises (IncompatibleFrequency , match = msg ):
188191 index .intersection (index3 , sort = sort )
189192
190193 def test_intersection_cases (self , sort ):
0 commit comments