def test_make_aware_default_tz(settings):
"""Tests datetimes are made aware of the configured timezone."""
settings.USE_TZ = True
datetime_object = datetime(2016, 1, 2, 21, 52, 25)
assert timezone.is_naive(datetime_object)
datetime_aware = make_aware(datetime_object)
assert timezone.is_aware(datetime_aware)
# Not comparing `tzinfo` directly because that depends on the combination of
# actual date+times
assert datetime_aware.tzinfo.zone == timezone.get_default_timezone().zone
评论列表
文章目录