From 55e8fdad297b45d637b5fc0c155d6ba69675a83c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Fri, 22 Mar 2024 18:16:24 +0100 Subject: [PATCH] [tests] use 'datetime.timezone.utc' instead of 'datetime.UTC' 'datetime.UTC' was added in Python 3.11 and is not defined in older versions. --- test/test_formatter.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/test_formatter.py b/test/test_formatter.py index 26adbdee..89cb1aad 100644 --- a/test/test_formatter.py +++ b/test/test_formatter.py @@ -238,13 +238,15 @@ class TestFormatter(unittest.TestCase): self._run_test("{t!d:O2}", "2010-01-01 02:00:00") def test_offset_local(self): - ts = self.kwdict["dt"].replace(tzinfo=datetime.UTC).timestamp() + ts = self.kwdict["dt"].replace( + tzinfo=datetime.timezone.utc).timestamp() offset = time.localtime(ts).tm_gmtoff dt = self.kwdict["dt"] + datetime.timedelta(seconds=offset) self._run_test("{dt:O}", str(dt)) self._run_test("{dt:Olocal}", str(dt)) - ts = self.kwdict["dt_dst"].replace(tzinfo=datetime.UTC).timestamp() + ts = self.kwdict["dt_dst"].replace( + tzinfo=datetime.timezone.utc).timestamp() offset = time.localtime(ts).tm_gmtoff dt = self.kwdict["dt_dst"] + datetime.timedelta(seconds=offset) self._run_test("{dt_dst:O}", str(dt))