示例#1
0
 def test_rlist_slice(self):
     l = self.sample_list()
     LIST = typeOf(l).TO
     self.check_list(ll_listslice_startonly(LIST, l, 0), [42, 43, 44, 45])
     self.check_list(ll_listslice_startonly(LIST, l, 1), [43, 44, 45])
     self.check_list(ll_listslice_startonly(LIST, l, 2), [44, 45])
     self.check_list(ll_listslice_startonly(LIST, l, 3), [45])
     self.check_list(ll_listslice_startonly(LIST, l, 4), [])
     for start in range(5):
         for stop in range(start, 8):
             s = ll_newslice(start, stop)
             self.check_list(ll_listslice(LIST, l, s), [42, 43, 44, 45][start:stop])
示例#2
0
 def test_rlist_slice(self):
     l = self.sample_list()
     LIST = typeOf(l).TO
     self.check_list(ll_listslice_startonly(LIST, l, 0), [42, 43, 44, 45])
     self.check_list(ll_listslice_startonly(LIST, l, 1), [43, 44, 45])
     self.check_list(ll_listslice_startonly(LIST, l, 2), [44, 45])
     self.check_list(ll_listslice_startonly(LIST, l, 3), [45])
     self.check_list(ll_listslice_startonly(LIST, l, 4), [])
     for start in range(5):
         for stop in range(start, 8):
             s = ll_newslice(start, stop)
             self.check_list(ll_listslice(LIST, l, s), [42, 43, 44, 45][start:stop])
示例#3
0
 def test_rlist_delslice(self):
     l = self.sample_list()
     ll_listdelslice_startonly(l, 3)
     self.check_list(l, [42, 43, 44])
     ll_listdelslice_startonly(l, 0)
     self.check_list(l, [])
     for start in range(5):
         for stop in range(start, 8):
             l = self.sample_list()
             s = ll_newslice(start, stop)
             ll_listdelslice(l, s)
             expected = [42, 43, 44, 45]
             del expected[start:stop]
             self.check_list(l, expected)
示例#4
0
 def test_rlist_delslice(self):
     l = self.sample_list()
     ll_listdelslice_startonly(l, 3)
     self.check_list(l, [42, 43, 44])
     ll_listdelslice_startonly(l, 0)
     self.check_list(l, [])
     for start in range(5):
         for stop in range(start, 8):
             l = self.sample_list()
             s = ll_newslice(start, stop)
             ll_listdelslice(l, s)
             expected = [42, 43, 44, 45]
             del expected[start:stop]
             self.check_list(l, expected)
示例#5
0
 def test_rlist_setslice(self):
     n = 100
     for start in range(5):
         for stop in range(start, 5):
             l1 = self.sample_list()
             l2 = self.sample_list()
             expected = [42, 43, 44, 45]
             for i in range(start, stop):
                 expected[i] = n
                 ll_setitem(l2, i, n)
                 n += 1
             s = ll_newslice(start, stop)
             l2 = ll_listslice(typeOf(l2).TO, l2, s)
             ll_listsetslice(l1, s, l2)
             self.check_list(l1, expected)
示例#6
0
 def test_rlist_setslice(self):
     n = 100
     for start in range(5):
         for stop in range(start, 5):
             l1 = self.sample_list()
             l2 = self.sample_list()
             expected = [42, 43, 44, 45]
             for i in range(start, stop):
                 expected[i] = n
                 ll_setitem(l2, i, n)
                 n += 1
             s = ll_newslice(start, stop)
             l2 = ll_listslice(typeOf(l2).TO, l2, s)
             ll_listsetslice(l1, s, l2)
             self.check_list(l1, expected)