'Subselects honor any manual ordering'

def test_ordered_subselect(self):

    try:
        query = DumbCategory.objects.filter(id__in=DumbCategory.objects.order_by('-id')[0:2])
        self.assertEquals(set(query.values_list('id', flat=True)), set([2, 3]))
        query = DumbCategory.objects.filter(id__in=DumbCategory.objects.order_by('-id')[:2])
        self.assertEquals(set(query.values_list('id', flat=True)), set([2, 3]))
        query = DumbCategory.objects.filter(id__in=DumbCategory.objects.order_by('-id')[2:])
        self.assertEquals(set(query.values_list('id', flat=True)), set([1]))
    except DatabaseError:
        self.assertFalse(connections[DEFAULT_DB_ALIAS].features.allow_sliced_subqueries)
