                  Session.objects.annotate(dt=Min('events__dt')).filter(dt__lt=afternoon_min_dt),
                  [morning_min_dt],
                  transform=lambda d: d.dt)
          self.assertQuerysetEqual(
                  Session.objects.annotate(dt=Min('events__dt')).filter(dt__gte=afternoon_min_dt),
                  [afternoon_min_dt],
                  transform=lambda d: d.dt)
  
      def test_query_datetimes(self):
          Event.objects.create(dt=datetime.datetime(2011, 1, 1, 1, 30, 0))
          Event.objects.create(dt=datetime.datetime(2011, 1, 1, 4, 30, 0))
          self.assertQuerysetEqual(Event.objects.datetimes('dt', 'year'),
 
</s> remove                 Session.objects.annotate(dt=Min('events__dt')).filter(dt__gte=afternoon_min_dt),
                [afternoon_min_dt],
                transform=lambda d: d.dt)
 </s> add             Session.objects.annotate(dt=Min('events__dt')).filter(dt__gte=afternoon_min_dt),
            [afternoon_min_dt],
            transform=lambda d: d.dt) </s> remove         self.assertQuerysetEqual(Event.objects.datetimes('dt', 'year'),
                [datetime.datetime(2011, 1, 1, 0, 0, 0)],
                transform=lambda d: d)
        self.assertQuerysetEqual(Event.objects.datetimes('dt', 'month'),
                [datetime.datetime(2011, 1, 1, 0, 0, 0)],
                transform=lambda d: d)
        self.assertQuerysetEqual(Event.objects.datetimes('dt', 'day'),
                [datetime.datetime(2011, 1, 1, 0, 0, 0)],
                transform=lambda d: d)
        self.assertQuerysetEqual(Event.objects.datetimes('dt', 'hour'),
                [datetime.datetime(2011, 1, 1, 1, 0, 0),
                 datetime.datetime(2011, 1, 1, 4, 0, 0)],
                transform=lambda d: d)
        self.assertQuerysetEqual(Event.objects.datetimes('dt', 'minute'),
                [datetime.datetime(2011, 1, 1, 1, 30, 0),
                 datetime.datetime(2011, 1, 1, 4, 30, 0)],
                transform=lambda d: d)
        self.assertQuerysetEqual(Event.objects.datetimes('dt', 'second'),
                [datetime.datetime(2011, 1, 1, 1, 30, 0),
                 datetime.datetime(2011, 1, 1, 4, 30, 0)],
                transform=lambda d: d)
 </s> add         self.assertQuerysetEqual(
            Event.objects.datetimes('dt', 'year'),
            [datetime.datetime(2011, 1, 1, 0, 0, 0)],
            transform=lambda d: d)
        self.assertQuerysetEqual(
            Event.objects.datetimes('dt', 'month'),
            [datetime.datetime(2011, 1, 1, 0, 0, 0)],
            transform=lambda d: d)
        self.assertQuerysetEqual(
            Event.objects.datetimes('dt', 'day'),
            [datetime.datetime(2011, 1, 1, 0, 0, 0)],
            transform=lambda d: d)
        self.assertQuerysetEqual(
            Event.objects.datetimes('dt', 'hour'),
            [datetime.datetime(2011, 1, 1, 1, 0, 0),
             datetime.datetime(2011, 1, 1, 4, 0, 0)],
            transform=lambda d: d)
        self.assertQuerysetEqual(
            Event.objects.datetimes('dt', 'minute'),
            [datetime.datetime(2011, 1, 1, 1, 30, 0),
             datetime.datetime(2011, 1, 1, 4, 30, 0)],
            transform=lambda d: d)
        self.assertQuerysetEqual(
            Event.objects.datetimes('dt', 'second'),
            [datetime.datetime(2011, 1, 1, 1, 30, 0),
             datetime.datetime(2011, 1, 1, 4, 30, 0)],
            transform=lambda d: d) </s> remove         self.assertQuerysetEqual(Event.objects.datetimes('dt', 'year'),
                [datetime.datetime(2011, 1, 1, 0, 0, 0, tzinfo=EAT)],
                transform=lambda d: d)
        self.assertQuerysetEqual(Event.objects.datetimes('dt', 'month'),
                [datetime.datetime(2011, 1, 1, 0, 0, 0, tzinfo=EAT)],
                transform=lambda d: d)
        self.assertQuerysetEqual(Event.objects.datetimes('dt', 'day'),
                [datetime.datetime(2011, 1, 1, 0, 0, 0, tzinfo=EAT)],
                transform=lambda d: d)
        self.assertQuerysetEqual(Event.objects.datetimes('dt', 'hour'),
                [datetime.datetime(2011, 1, 1, 1, 0, 0, tzinfo=EAT),
                 datetime.datetime(2011, 1, 1, 4, 0, 0, tzinfo=EAT)],
                transform=lambda d: d)
        self.assertQuerysetEqual(Event.objects.datetimes('dt', 'minute'),
                [datetime.datetime(2011, 1, 1, 1, 30, 0, tzinfo=EAT),
                 datetime.datetime(2011, 1, 1, 4, 30, 0, tzinfo=EAT)],
                transform=lambda d: d)
        self.assertQuerysetEqual(Event.objects.datetimes('dt', 'second'),
                [datetime.datetime(2011, 1, 1, 1, 30, 0, tzinfo=EAT),
                 datetime.datetime(2011, 1, 1, 4, 30, 0, tzinfo=EAT)],
                transform=lambda d: d)
 </s> add         self.assertQuerysetEqual(
            Event.objects.datetimes('dt', 'year'),
            [datetime.datetime(2011, 1, 1, 0, 0, 0, tzinfo=EAT)],
            transform=lambda d: d)
        self.assertQuerysetEqual(
            Event.objects.datetimes('dt', 'month'),
            [datetime.datetime(2011, 1, 1, 0, 0, 0, tzinfo=EAT)],
            transform=lambda d: d)
        self.assertQuerysetEqual(
            Event.objects.datetimes('dt', 'day'),
            [datetime.datetime(2011, 1, 1, 0, 0, 0, tzinfo=EAT)],
            transform=lambda d: d)
        self.assertQuerysetEqual(
            Event.objects.datetimes('dt', 'hour'),
            [datetime.datetime(2011, 1, 1, 1, 0, 0, tzinfo=EAT),
             datetime.datetime(2011, 1, 1, 4, 0, 0, tzinfo=EAT)],
            transform=lambda d: d)
        self.assertQuerysetEqual(
            Event.objects.datetimes('dt', 'minute'),
            [datetime.datetime(2011, 1, 1, 1, 30, 0, tzinfo=EAT),
             datetime.datetime(2011, 1, 1, 4, 30, 0, tzinfo=EAT)],
            transform=lambda d: d)
        self.assertQuerysetEqual(
            Event.objects.datetimes('dt', 'second'),
            [datetime.datetime(2011, 1, 1, 1, 30, 0, tzinfo=EAT),
             datetime.datetime(2011, 1, 1, 4, 30, 0, tzinfo=EAT)],
            transform=lambda d: d) </s> remove             self.assertQuerysetEqual(Event.objects.datetimes('dt', 'year'),
                    [datetime.datetime(2010, 1, 1, 0, 0, 0, tzinfo=UTC),
                     datetime.datetime(2011, 1, 1, 0, 0, 0, tzinfo=UTC)],
                    transform=lambda d: d)
            self.assertQuerysetEqual(Event.objects.datetimes('dt', 'month'),
                    [datetime.datetime(2010, 12, 1, 0, 0, 0, tzinfo=UTC),
                     datetime.datetime(2011, 1, 1, 0, 0, 0, tzinfo=UTC)],
                    transform=lambda d: d)
            self.assertQuerysetEqual(Event.objects.datetimes('dt', 'day'),
                    [datetime.datetime(2010, 12, 31, 0, 0, 0, tzinfo=UTC),
                     datetime.datetime(2011, 1, 1, 0, 0, 0, tzinfo=UTC)],
                    transform=lambda d: d)
            self.assertQuerysetEqual(Event.objects.datetimes('dt', 'hour'),
                    [datetime.datetime(2010, 12, 31, 22, 0, 0, tzinfo=UTC),
                     datetime.datetime(2011, 1, 1, 1, 0, 0, tzinfo=UTC)],
                    transform=lambda d: d)
            self.assertQuerysetEqual(Event.objects.datetimes('dt', 'minute'),
                    [datetime.datetime(2010, 12, 31, 22, 30, 0, tzinfo=UTC),
                     datetime.datetime(2011, 1, 1, 1, 30, 0, tzinfo=UTC)],
                    transform=lambda d: d)
            self.assertQuerysetEqual(Event.objects.datetimes('dt', 'second'),
                    [datetime.datetime(2010, 12, 31, 22, 30, 0, tzinfo=UTC),
                     datetime.datetime(2011, 1, 1, 1, 30, 0, tzinfo=UTC)],
                    transform=lambda d: d)
 </s> add             self.assertQuerysetEqual(
                Event.objects.datetimes('dt', 'year'),
                [datetime.datetime(2010, 1, 1, 0, 0, 0, tzinfo=UTC),
                 datetime.datetime(2011, 1, 1, 0, 0, 0, tzinfo=UTC)],
                transform=lambda d: d)
            self.assertQuerysetEqual(
                Event.objects.datetimes('dt', 'month'),
                [datetime.datetime(2010, 12, 1, 0, 0, 0, tzinfo=UTC),
                 datetime.datetime(2011, 1, 1, 0, 0, 0, tzinfo=UTC)],
                transform=lambda d: d)
            self.assertQuerysetEqual(
                Event.objects.datetimes('dt', 'day'),
                [datetime.datetime(2010, 12, 31, 0, 0, 0, tzinfo=UTC),
                 datetime.datetime(2011, 1, 1, 0, 0, 0, tzinfo=UTC)],
                transform=lambda d: d)
            self.assertQuerysetEqual(
                Event.objects.datetimes('dt', 'hour'),
                [datetime.datetime(2010, 12, 31, 22, 0, 0, tzinfo=UTC),
                 datetime.datetime(2011, 1, 1, 1, 0, 0, tzinfo=UTC)],
                transform=lambda d: d)
            self.assertQuerysetEqual(
                Event.objects.datetimes('dt', 'minute'),
                [datetime.datetime(2010, 12, 31, 22, 30, 0, tzinfo=UTC),
                 datetime.datetime(2011, 1, 1, 1, 30, 0, tzinfo=UTC)],
                transform=lambda d: d)
            self.assertQuerysetEqual(
                Event.objects.datetimes('dt', 'second'),
                [datetime.datetime(2010, 12, 31, 22, 30, 0, tzinfo=UTC),
                 datetime.datetime(2011, 1, 1, 1, 30, 0, tzinfo=UTC)],
                transform=lambda d: d) </s> remove                 Session.objects.annotate(dt=Min('events__dt')).order_by('dt'),
                [morning_min_dt, afternoon_min_dt],
                transform=lambda d: d.dt)
 </s> add             Session.objects.annotate(dt=Min('events__dt')).order_by('dt'),
            [morning_min_dt, afternoon_min_dt],
            transform=lambda d: d.dt)
            Session.objects.annotate(dt=Min('events__dt')).filter(dt__gte=afternoon_min_dt),
            [afternoon_min_dt],
            transform=lambda d: d.dt)
                  Session.objects.annotate(dt=Min('events__dt')).filter(dt__lt=afternoon_min_dt),
                  [morning_min_dt],
                  transform=lambda d: d.dt)
          self.assertQuerysetEqual(
            Session.objects.annotate(dt=Min('events__dt')).filter(dt__gte=afternoon_min_dt),
            [afternoon_min_dt],
            transform=lambda d: d.dt)
            Session.objects.annotate(dt=Min('events__dt')).filter(dt__gte=afternoon_min_dt),
            [afternoon_min_dt],
            transform=lambda d: d.dt)
            Session.objects.annotate(dt=Min('events__dt')).filter(dt__gte=afternoon_min_dt),
            [afternoon_min_dt],
            transform=lambda d: d.dt)
  
      def test_query_datetimes(self):
          Event.objects.create(dt=datetime.datetime(2011, 1, 1, 1, 30, 0))
          Event.objects.create(dt=datetime.datetime(2011, 1, 1, 4, 30, 0))
          self.assertQuerysetEqual(Event.objects.datetimes('dt', 'year'),
keep keep keep keep replace replace replace keep keep keep keep keep
 Fixed #21288 -- Fixed E126 pep8 warnings 
tests/timezones/tests.py