Skip to content

Commit 49a2f7e

Browse files
committed
Replace deprecated datetime.datetime.utcnow()
It was deprecated in Python 3.12[1]. [1] https://docs.python.org/3.12/library/datetime.html#datetime.datetime.utcnow
1 parent a1c53db commit 49a2f7e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tests/test_flask_encoder.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ def test_json_encoder():
1818
s = json.dumps(datetime.date.today(), cls=json_encoder)
1919
assert len(s) == 12
2020

21-
s = json.dumps(datetime.datetime.utcnow(), cls=json_encoder)
21+
s = json.dumps(
22+
datetime.datetime.now(tz=datetime.timezone.utc).replace(tzinfo=None),
23+
cls=json_encoder,
24+
)
2225
assert s.endswith('Z"')
2326

2427
s = json.dumps(Decimal(1.01), cls=json_encoder)

0 commit comments

Comments
 (0)