+ def test_slice(self):
+ qs = LdapGroup.objects.all()
+ objs = list(qs)
+ self.assertEquals(len(objs), 3)
+ self.assertEquals(objs[0].gid, 1000)
+ self.assertEquals(objs[1].gid, 1001)
+ self.assertEquals(objs[2].gid, 1002)
+
+ # limit only
+ qs = LdapGroup.objects.all()
+ objs = qs[:2]
+ self.assertEquals(objs.count(), 2)
+
+ objs = qs[:2]
+ self.assertEquals(len(objs), 2)
+ self.assertEquals(objs[0].gid, 1000)
+ self.assertEquals(objs[1].gid, 1001)
+
+ # offset only
+ qs = LdapGroup.objects.all()
+ objs = qs[1:]
+ self.assertEquals(objs.count(), 2)
+
+ objs = qs[1:]
+ self.assertEquals(len(objs), 2)
+ self.assertEquals(objs[0].gid, 1001)
+ self.assertEquals(objs[1].gid, 1002)
+
+ # offset and limit
+ qs = LdapGroup.objects.all()
+ objs = qs[1:2]
+ self.assertEquals(objs.count(), 1)
+
+ objs = qs[1:2]
+ self.assertEquals(len(objs), 1)
+ self.assertEquals(objs[0].gid, 1001)
+