Skip to content

Commit 3364f43

Browse files
SG-37924 Replace utcfromtimestamp for Python 3.12 (#390)
* Replace `utcfromtimestamp` for Python 3.12 * Support expected value
1 parent 6f3c8d7 commit 3364f43

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

tests/test_client.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,12 @@ def test_transform_data(self):
579579
now = datetime.datetime.fromtimestamp(timestamp).replace(
580580
microsecond=0, tzinfo=SG_TIMEZONE.local
581581
)
582-
utc_now = datetime.datetime.utcfromtimestamp(timestamp).replace(microsecond=0)
582+
utc_now = (
583+
datetime.datetime.fromtimestamp(timestamp, tz=datetime.timezone.utc)
584+
.replace(microsecond=0)
585+
.astimezone(None)
586+
.replace(tzinfo=None)
587+
)
583588
local = {"date": now.strftime("%Y-%m-%d"), "datetime": now, "time": now.time()}
584589
# date will still be the local date, because they are not transformed
585590
utc = {

0 commit comments

Comments
 (0)