'Ensure slicing a queryset works as expected.'

def test_slice(self):

    user_a = self.Person.objects.create(name='User    A', age=20)
    user_b = self.Person.objects.create(name='User    B', age=30)
    user_c = self.Person.objects.create(name='User    C', age=40)
    people = list(self.Person.objects[:2])
    self.assertEqual(len(people), 2)
    self.assertEqual(people[0], user_a)
    self.assertEqual(people[1], user_b)
    people = list(self.Person.objects[1:])
    self.assertEqual(len(people), 2)
    self.assertEqual(people[0], user_b)
    self.assertEqual(people[1], user_c)
    people = list(self.Person.objects[1:2])
    self.assertEqual(len(people), 1)
    self.assertEqual(people[0], user_b)
    people = self.Person.objects
    self.assertEqual(len(people), 3)
    people2 = people[1:2]
    self.assertEqual(len(people2), 1)
    self.assertEqual(people2[0], user_b)
    qs = self.Person.objects[1:2]
    qs._cursor
    qs._cursor_obj = None
    people = list(qs)
    self.assertEqual(len(people), 1)
    self.assertEqual(people[0].name, 'User    B')
    people = list(self.Person.objects[1:1])
    self.assertEqual(len(people), 0)
    people = list(self.Person.objects[80000:80001])
    self.assertEqual(len(people), 0)
    self.Person.objects.delete()
    for i in range(55):
        self.Person(name=('A%s' % i), age=i).save()
    self.assertEqual(self.Person.objects.count(), 55)
    self.assertEqual('Person    object', ('%s' % self.Person.objects[0]))
    self.assertEqual('[<Person:    Person    object>,    <Person:    Person    object>]', ('%s' % self.Person.objects[1:3]))
    self.assertEqual('[<Person:    Person    object>,    <Person:    Person    object>]', ('%s' % self.Person.objects[51:53]))
