mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Refs #32365 -- Removed internal uses of utils.timezone.utc alias.
Remaining test case ensures that uses of the alias are mapped canonically by the migration writer.
This commit is contained in:
committed by
Mariusz Felisiak
parent
1cf60ce601
commit
bb61f0186d
@@ -1,15 +1,10 @@
|
||||
from datetime import date, datetime, time, tzinfo
|
||||
from datetime import date, datetime, time, timezone, tzinfo
|
||||
|
||||
from django.test import SimpleTestCase, override_settings
|
||||
from django.test.utils import TZ_SUPPORT, requires_tz_support
|
||||
from django.utils import dateformat, translation
|
||||
from django.utils.dateformat import format
|
||||
from django.utils.timezone import (
|
||||
get_default_timezone,
|
||||
get_fixed_timezone,
|
||||
make_aware,
|
||||
utc,
|
||||
)
|
||||
from django.utils.timezone import get_default_timezone, get_fixed_timezone, make_aware
|
||||
|
||||
|
||||
@override_settings(TIME_ZONE="Europe/Copenhagen")
|
||||
@@ -71,7 +66,7 @@ class DateFormatTests(SimpleTestCase):
|
||||
)
|
||||
|
||||
def test_epoch(self):
|
||||
udt = datetime(1970, 1, 1, tzinfo=utc)
|
||||
udt = datetime(1970, 1, 1, tzinfo=timezone.utc)
|
||||
self.assertEqual(format(udt, "U"), "0")
|
||||
|
||||
def test_empty_format(self):
|
||||
@@ -216,7 +211,7 @@ class DateFormatTests(SimpleTestCase):
|
||||
|
||||
@requires_tz_support
|
||||
def test_e_format_with_named_time_zone(self):
|
||||
dt = datetime(1970, 1, 1, tzinfo=utc)
|
||||
dt = datetime(1970, 1, 1, tzinfo=timezone.utc)
|
||||
self.assertEqual(dateformat.format(dt, "e"), "UTC")
|
||||
|
||||
@requires_tz_support
|
||||
|
||||
@@ -2,7 +2,7 @@ import datetime
|
||||
|
||||
from django.test import SimpleTestCase
|
||||
from django.utils import feedgenerator
|
||||
from django.utils.timezone import get_fixed_timezone, utc
|
||||
from django.utils.timezone import get_fixed_timezone
|
||||
|
||||
|
||||
class FeedgeneratorTests(SimpleTestCase):
|
||||
@@ -144,4 +144,7 @@ class FeedgeneratorTests(SimpleTestCase):
|
||||
for use_tz in (True, False):
|
||||
with self.settings(USE_TZ=use_tz):
|
||||
rss_feed = feedgenerator.Rss201rev2Feed("title", "link", "description")
|
||||
self.assertEqual(rss_feed.latest_post_date().tzinfo, utc)
|
||||
self.assertEqual(
|
||||
rss_feed.latest_post_date().tzinfo,
|
||||
datetime.timezone.utc,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user