@pytest.mark.django_db
def test_make_aware_explicit_tz(settings):
 settings.USE_TZ = True
 given_timezone = pytz.timezone('Asia/Bangkok')
 datetime_object = datetime(2016, 1, 2, 21, 52, 25)
 assert timezone.is_naive(datetime_object)
 datetime_aware = make_aware(datetime_object, tz=given_timezone)
 assert timezone.is_aware(datetime_aware)
 assert (datetime_aware.tzinfo.zone == given_timezone.zone)

@ pytest . mark . django_db def test_make_aware_explicit_tz ( settings ) : settings . USE_TZ = True given_timezone = pytz . timezone ( 'Asia/Bangkok' ) datetime_object = datetime ( 2016 , 1 , 2 , 21 , 52 , 25 ) assert timezone . is_naive ( datetime_object ) datetime_aware = make_aware ( datetime_object , tz = given_timezone ) assert timezone . is_aware ( datetime_aware ) assert ( datetime_aware . tzinfo . zone == given_timezone . zone )
tests datetimes are made aware of the given timezone .