@@ -270,7 +270,9 @@ def test_disallow_setting_tz(self, tz):
270270 ts .tz = tz
271271
272272 def test_default_to_stdlib_utc (self ):
273- assert Timestamp .utcnow ().tz is timezone .utc
273+ msg = "Timestamp.utcnow is deprecated"
274+ with tm .assert_produces_warning (FutureWarning , match = msg ):
275+ assert Timestamp .utcnow ().tz is timezone .utc
274276 assert Timestamp .now ("UTC" ).tz is timezone .utc
275277 assert Timestamp ("2016-01-01" , tz = "UTC" ).tz is timezone .utc
276278
@@ -313,11 +315,15 @@ def compare(x, y):
313315 compare (Timestamp .now (), datetime .now ())
314316 compare (Timestamp .now ("UTC" ), datetime .now (pytz .timezone ("UTC" )))
315317 compare (Timestamp .now ("UTC" ), datetime .now (tzutc ()))
316- compare (Timestamp .utcnow (), datetime .now (timezone .utc ))
318+ msg = "Timestamp.utcnow is deprecated"
319+ with tm .assert_produces_warning (FutureWarning , match = msg ):
320+ compare (Timestamp .utcnow (), datetime .now (timezone .utc ))
317321 compare (Timestamp .today (), datetime .today ())
318322 current_time = calendar .timegm (datetime .now ().utctimetuple ())
319323
320- ts_utc = Timestamp .utcfromtimestamp (current_time )
324+ msg = "Timestamp.utcfromtimestamp is deprecated"
325+ with tm .assert_produces_warning (FutureWarning , match = msg ):
326+ ts_utc = Timestamp .utcfromtimestamp (current_time )
321327 assert ts_utc .timestamp () == current_time
322328 compare (
323329 Timestamp .fromtimestamp (current_time ), datetime .fromtimestamp (current_time )
0 commit comments