[rset] cubes such as iliane hi-jack rset description by poping some lines from it. Handle this on RepeatList stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 30 Mar 2010 13:27:30 +0200
branchstable
changeset 5077 dc448c9ad9dd
parent 5076 b0e6134b4324
child 5078 ea66c4aabb47
[rset] cubes such as iliane hi-jack rset description by poping some lines from it. Handle this on RepeatList
test/unittest_utils.py
utils.py
--- a/test/unittest_utils.py	Tue Mar 30 11:18:31 2010 +0200
+++ b/test/unittest_utils.py	Tue Mar 30 13:27:30 2010 +0200
@@ -78,6 +78,14 @@
         x = l + [(1, 3)] * 2
         self.assertEquals(x, [(1, 3)] * 5)
 
+    def test_eq(self):
+        self.assertEquals(RepeatList(3, (1, 3)),
+                          [(1, 3)]*3)
+
+    def test_pop(self):
+        l = RepeatList(3, (1, 3))
+        l.pop(2)
+        self.assertEquals(l, [(1, 3)]*2)
 
 class SizeConstrainedListTC(TestCase):
 
--- a/utils.py	Tue Mar 30 11:18:31 2010 +0200
+++ b/utils.py	Tue Mar 30 13:27:30 2010 +0200
@@ -135,7 +135,8 @@
         if isinstance(other, RepeatList):
             return other._size == self.size and other._item == self.item
         return self[:] == other
-
+    def pop(self, i):
+        self._size -= 1
 
 class UStringIO(list):
     """a file wrapper which automatically encode unicode string to an encoding