'Slice a query that has a sliced subquery'

def test_slice_subquery_and_query(self):

    try:
        query = DumbCategory.objects.filter(id__in=DumbCategory.objects.order_by(u'-id')[0:2])[0:2]
        self.assertEqual(set([x.id for x in query]), set([3, 4]))
        query = DumbCategory.objects.filter(id__in=DumbCategory.objects.order_by(u'-id')[1:3])[1:3]
        self.assertEqual(set([x.id for x in query]), set([3]))
        query = DumbCategory.objects.filter(id__in=DumbCategory.objects.order_by(u'-id')[2:])[1:]
        self.assertEqual(set([x.id for x in query]), set([2]))
    except DatabaseError as e:
        self.assertFalse(connections[DEFAULT_DB_ALIAS].features.allow_sliced_subqueries, str(e))
