@@ -205,12 +205,12 @@ def test_changed_partition(self):
205205 PositionPartition ("p_20210101" ).set_position ([1 , 2 , 3 , 4 ])
206206 )
207207 self .assertFalse (c .has_modifications )
208- c .set_timestamp (datetime (2021 , 1 , 2 ))
208+ c .set_timestamp (datetime (2021 , 1 , 2 , tzinfo = timezone . utc ))
209209 y = c .set_position ([10 , 10 , 10 , 10 ])
210210 self .assertEqual (c , y )
211211 self .assertTrue (c .has_modifications )
212212
213- self .assertEqual (c .timestamp (), datetime (2021 , 1 , 2 ))
213+ self .assertEqual (c .timestamp (), datetime (2021 , 1 , 2 , tzinfo = timezone . utc ))
214214 self .assertEqual (c .position .as_list (), [10 , 10 , 10 , 10 ])
215215
216216 self .assertEqual (
@@ -276,7 +276,7 @@ def test_changed_partition(self):
276276 .as_partition (),
277277 NewPlannedPartition ()
278278 .set_columns (4 )
279- .set_timestamp (datetime (2021 , 1 , 1 ))
279+ .set_timestamp (datetime (2021 , 1 , 1 , tzinfo = timezone . utc ))
280280 .as_partition (),
281281 )
282282
@@ -287,7 +287,9 @@ def test_new_partition(self):
287287 self .assertEqual (
288288 NewPlannedPartition ()
289289 .set_columns (5 )
290- .set_timestamp (datetime (2021 , 12 , 31 , hour = 23 , minute = 15 ))
290+ .set_timestamp (
291+ datetime (2021 , 12 , 31 , hour = 23 , minute = 15 , tzinfo = timezone .utc )
292+ )
291293 .as_partition (),
292294 MaxValuePartition ("p_20211231" , count = 5 ),
293295 )
@@ -297,34 +299,38 @@ def test_new_partition(self):
297299 self .assertEqual (
298300 NewPlannedPartition ()
299301 .set_position ([3 ])
300- .set_timestamp (datetime (2021 , 12 , 31 ))
302+ .set_timestamp (datetime (2021 , 12 , 31 , tzinfo = timezone . utc ))
301303 .as_partition (),
302304 PositionPartition ("p_20211231" ).set_position (mkPos (3 )),
303305 )
304306
305307 self .assertEqual (
306308 NewPlannedPartition ()
307309 .set_position ([1 , 1 , 1 ])
308- .set_timestamp (datetime (1994 , 1 , 1 ))
310+ .set_timestamp (datetime (1994 , 1 , 1 , tzinfo = timezone . utc ))
309311 .as_partition (),
310312 PositionPartition ("p_19940101" ).set_position ([1 , 1 , 1 ]),
311313 )
312314
313315 self .assertEqual (
314316 NewPlannedPartition ()
315317 .set_position ([3 ])
316- .set_timestamp (datetime (2021 , 12 , 31 )),
318+ .set_timestamp (datetime (2021 , 12 , 31 , tzinfo = timezone . utc )),
317319 NewPlannedPartition ()
318320 .set_position ([3 ])
319- .set_timestamp (datetime (2021 , 12 , 31 )),
321+ .set_timestamp (datetime (2021 , 12 , 31 , tzinfo = timezone . utc )),
320322 )
321323
322324 self .assertEqual (
323325 NewPlannedPartition ()
324326 .set_position ([99 , 999 ])
325- .set_timestamp (datetime (2021 , 12 , 31 , hour = 19 , minute = 2 ))
327+ .set_timestamp (
328+ datetime (2021 , 12 , 31 , hour = 19 , minute = 2 , tzinfo = timezone .utc )
329+ )
326330 .set_as_max_value (),
327- NewPlannedPartition ().set_columns (2 ).set_timestamp (datetime (2021 , 12 , 31 )),
331+ NewPlannedPartition ()
332+ .set_columns (2 )
333+ .set_timestamp (datetime (2021 , 12 , 31 , tzinfo = timezone .utc )),
328334 )
329335
330336
@@ -380,7 +386,7 @@ def test_partition_tuple_ordering(self):
380386 self .assertLess (cur_pos , p_20230724 )
381387
382388 def test_instant_partition (self ):
383- now = datetime .utcnow ( )
389+ now = datetime .now ( tz = timezone . utc )
384390
385391 ip = InstantPartition ("p_20380101" , now , [1 , 2 ])
386392 self .assertEqual (ip .position .as_list (), [1 , 2 ])
@@ -390,7 +396,9 @@ def test_instant_partition(self):
390396 def test_is_partition_type (self ):
391397 self .assertTrue (is_partition_type (mkPPart ("b" , 1 , 2 )))
392398 self .assertTrue (
393- is_partition_type (InstantPartition ("p_19490520" , datetime .utcnow (), [1 , 2 ]))
399+ is_partition_type (
400+ InstantPartition ("p_19490520" , datetime .now (tz = timezone .utc ), [1 , 2 ])
401+ )
394402 )
395403 self .assertFalse (is_partition_type (None ))
396404 self .assertFalse (is_partition_type (1 ))
0 commit comments