'If the truncated datetime transitions to a different offset (daylight
saving) then the returned value will have that new timezone/offset.'

def test_trunc_func_with_timezone(self):

    start_datetime = microsecond_support(datetime(2015, 6, 15, 14, 30, 50, 321))
    end_datetime = microsecond_support(datetime(2016, 6, 15, 14, 10, 50, 123))
    start_datetime = timezone.make_aware(start_datetime, is_dst=False)
    end_datetime = timezone.make_aware(end_datetime, is_dst=False)
    self.create_model(start_datetime, end_datetime)
    self.create_model(end_datetime, start_datetime)
    melb = pytz.timezone('Australia/Melbourne')
    def test_datetime_kind(kind):
        self.assertQuerysetEqual(DTModel.objects.annotate(truncated=Trunc('start_datetime', kind, output_field=DateTimeField(), tzinfo=melb)).order_by('start_datetime'), [(start_datetime, truncate_to(start_datetime.astimezone(melb), kind, melb)), (end_datetime, truncate_to(end_datetime.astimezone(melb), kind, melb))], (lambda m: (m.start_datetime, m.truncated)))
    def test_date_kind(kind):
        self.assertQuerysetEqual(DTModel.objects.annotate(truncated=Trunc('start_date', kind, output_field=DateField(), tzinfo=melb)).order_by('start_datetime'), [(start_datetime, truncate_to(start_datetime.date(), kind)), (end_datetime, truncate_to(end_datetime.date(), kind))], (lambda m: (m.start_datetime, m.truncated)))
    def test_time_kind(kind):
        self.assertQuerysetEqual(DTModel.objects.annotate(truncated=Trunc('start_time', kind, output_field=TimeField(), tzinfo=melb)).order_by('start_datetime'), [(start_datetime, truncate_to(start_datetime.time(), kind)), (end_datetime, truncate_to(end_datetime.time(), kind))], (lambda m: (m.start_datetime, m.truncated)))
    test_date_kind('year')
    test_date_kind('quarter')
    test_date_kind('month')
    test_date_kind('day')
    test_time_kind('hour')
    test_time_kind('minute')
    test_time_kind('second')
    test_datetime_kind('year')
    test_datetime_kind('quarter')
    test_datetime_kind('month')
    test_datetime_kind('day')
    test_datetime_kind('hour')
    test_datetime_kind('minute')
    test_datetime_kind('second')
    qs = DTModel.objects.filter(start_datetime__date=Trunc('start_datetime', 'day', output_field=DateField()))
    self.assertEqual(qs.count(), 2)
