@@ -266,10 +266,15 @@ def test_tick_rdiv(cls):
266266 off = cls (10 )
267267 delta = off .delta
268268 td64 = delta .to_timedelta64 ()
269+ instance__type = "." .join ([cls .__module__ , cls .__name__ ])
270+ msg = (
271+ "unsupported operand type\\ (s\\ ) for \\ /: 'int'|'float' and "
272+ f"'{ instance__type } '"
273+ )
269274
270- with pytest .raises (TypeError ):
275+ with pytest .raises (TypeError , match = msg ):
271276 2 / off
272- with pytest .raises (TypeError ):
277+ with pytest .raises (TypeError , match = msg ):
273278 2.0 / off
274279
275280 assert (td64 * 2.5 ) / off == 2.5
@@ -330,14 +335,20 @@ def test_compare_ticks_to_strs(cls):
330335 assert not off == "infer"
331336 assert not "foo" == off
332337
338+ instance_type = "." .join ([cls .__module__ , cls .__name__ ])
339+ msg = (
340+ "'<'|'<='|'>'|'>=' not supported between instances of "
341+ f"'str' and '{ instance_type } '|'{ instance_type } ' and 'str'"
342+ )
343+
333344 for left , right in [("infer" , off ), (off , "infer" )]:
334- with pytest .raises (TypeError ):
345+ with pytest .raises (TypeError , match = msg ):
335346 left < right
336- with pytest .raises (TypeError ):
347+ with pytest .raises (TypeError , match = msg ):
337348 left <= right
338- with pytest .raises (TypeError ):
349+ with pytest .raises (TypeError , match = msg ):
339350 left > right
340- with pytest .raises (TypeError ):
351+ with pytest .raises (TypeError , match = msg ):
341352 left >= right
342353
343354
0 commit comments