From efb7f9ced2dcf71294353596a265e3fd67faffeb Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Tue, 18 Feb 2025 08:35:36 +0100 Subject: Refs #36005 -- Used datetime.UTC alias instead of datetime.timezone.utc. datetime.UTC was added in Python 3.11. --- tests/timezones/tests.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/timezones') diff --git a/tests/timezones/tests.py b/tests/timezones/tests.py index c45f078ef6..815da17026 100644 --- a/tests/timezones/tests.py +++ b/tests/timezones/tests.py @@ -65,7 +65,7 @@ except ImportError: # datetime.datetime(2011, 9, 1, 13, 20, 30), which translates to # 10:20:30 in UTC and 17:20:30 in ICT. -UTC = datetime.timezone.utc +UTC = datetime.UTC EAT = timezone.get_fixed_timezone(180) # Africa/Nairobi ICT = timezone.get_fixed_timezone(420) # Asia/Bangkok @@ -618,7 +618,7 @@ class NewDatabaseTests(TestCase): @skipIfDBFeature("supports_timezones") def test_cursor_execute_accepts_naive_datetime(self): dt = datetime.datetime(2011, 9, 1, 13, 20, 30, tzinfo=EAT) - utc_naive_dt = timezone.make_naive(dt, datetime.timezone.utc) + utc_naive_dt = timezone.make_naive(dt, UTC) with connection.cursor() as cursor: cursor.execute( "INSERT INTO timezones_event (dt) VALUES (%s)", [utc_naive_dt] @@ -637,7 +637,7 @@ class NewDatabaseTests(TestCase): @skipIfDBFeature("supports_timezones") def test_cursor_execute_returns_naive_datetime(self): dt = datetime.datetime(2011, 9, 1, 13, 20, 30, tzinfo=EAT) - utc_naive_dt = timezone.make_naive(dt, datetime.timezone.utc) + utc_naive_dt = timezone.make_naive(dt, UTC) Event.objects.create(dt=dt) with connection.cursor() as cursor: cursor.execute( -- cgit v1.3