mirror of
https://github.com/django/django.git
synced 2025-11-20 03:30:00 +00:00
Refs #36005 -- Used datetime.UTC alias instead of datetime.timezone.utc.
datetime.UTC was added in Python 3.11.
This commit is contained in:
parent
0d1dd6bba0
commit
efb7f9ced2
41 changed files with 271 additions and 272 deletions
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue