[pypy-svn] r25949 - in pypy/dist/pypy/rpython/ootypesystem: . test

antocuni at codespeak.net antocuni at codespeak.net
Tue Apr 18 16:03:48 CEST 2006


Author: antocuni
Date: Tue Apr 18 16:03:41 2006
New Revision: 25949

Modified:
   pypy/dist/pypy/rpython/ootypesystem/ootype.py
   pypy/dist/pypy/rpython/ootypesystem/test/test_oolist.py
   pypy/dist/pypy/rpython/ootypesystem/test/test_oortype.py
Log:
'append', 'extend' and 'remove_range' has been removed from
ootype.List._GENERIC_METHODS because they are no longer needed. Some
tests have been modified because the used 'append'.



Modified: pypy/dist/pypy/rpython/ootypesystem/ootype.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/ootype.py	(original)
+++ pypy/dist/pypy/rpython/ootypesystem/ootype.py	Tue Apr 18 16:03:41 2006
@@ -209,9 +209,9 @@
             "_ll_resize_ge": Meth([Signed], Void),
             "_ll_resize_le": Meth([Signed], Void),
             "_ll_resize": Meth([Signed], Void),
-            "append": Meth([self.ITEMTYPE_T], Void),            
-            "extend": Meth([self.SELFTYPE_T], Void),
-            "remove_range": Meth([Signed, Signed], Void), # remove_range(start, count)
+##            "append": Meth([self.ITEMTYPE_T], Void),            
+##            "extend": Meth([self.SELFTYPE_T], Void),
+##            "remove_range": Meth([Signed, Signed], Void), # remove_range(start, count)
         })
 
         self._setup_methods(generic_types)
@@ -567,11 +567,6 @@
             self._ll_resize_le(length)
         assert len(self._list) == length
 
-    def append(self, item):
-        # NOT_RPYTHON
-        assert typeOf(item) == self._TYPE._ITEMTYPE
-        self._list.append(item)
-
     def ll_getitem_fast(self, index):
         # NOT_RPYTHON
         assert typeOf(index) == Signed
@@ -585,14 +580,19 @@
         assert index >= 0
         self._list[index] = item
 
-    def extend(self, other):
-        # NOT_RPYTHON
-        assert typeOf(other) == typeOf(self)
-        self._list.extend(other._list)
-
-    def remove_range(self, start, count):
-        # NOT_RPYTHON        
-        del self._list[start:start+count]
+##    def append(self, item):
+##        # NOT_RPYTHON
+##        assert typeOf(item) == self._TYPE._ITEMTYPE
+##        self._list.append(item)
+
+##    def extend(self, other):
+##        # NOT_RPYTHON
+##        assert typeOf(other) == typeOf(self)
+##        self._list.extend(other._list)
+
+##    def remove_range(self, start, count):
+##        # NOT_RPYTHON        
+##        del self._list[start:start+count]
 
 class _null_list(_null_mixin(_list), _list):
 

Modified: pypy/dist/pypy/rpython/ootypesystem/test/test_oolist.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/test/test_oolist.py	(original)
+++ pypy/dist/pypy/rpython/ootypesystem/test/test_oolist.py	Tue Apr 18 16:03:41 2006
@@ -1,6 +1,7 @@
 import py
 from pypy.rpython.test.test_llinterp import interpret 
 from pypy.rpython.ootypesystem.ootype import *
+from pypy.rpython.rlist import ll_append
 
 def test_new():
     LT = List(Signed)
@@ -18,25 +19,37 @@
     l = new(LT)
     assert l.ll_length() == 0
 
-def test_append():
+def test_resize():
     LT = List(Signed)
-    l = new(LT)
-    l.append(1)
-    assert l.ll_length() == 1
-
-def test_extend():
-    LT = List(Signed)
-    l1 = new(LT)
-    l2 = new(LT)
-    l1.append(1)
-    l2.append(2)
-    l1.extend(l2)
-    assert l1.ll_length() == 2
+    lst = new(LT)
+    lst._ll_resize(10)
+    assert lst.ll_length() == 10
+    lst._ll_resize_ge(9)
+    assert lst.ll_length() == 10
+    lst._ll_resize_ge(20)
+    assert lst.ll_length() >= 20
+    lst._ll_resize_le(10)
+    assert lst.ll_length() <= 10
+
+##def test_append():
+##    LT = List(Signed)
+##    l = new(LT)
+##    l.append(1)
+##    assert l.ll_length() == 1
+
+##def test_extend():
+##    LT = List(Signed)
+##    l1 = new(LT)
+##    l2 = new(LT)
+##    l1.append(1)
+##    l2.append(2)
+##    l1.extend(l2)
+##    assert l1.ll_length() == 2
 
 def test_setitem_getitem():
     LT = List(Signed)
     l = new(LT)
-    l.append(2)
+    ll_append(l, 2)
     assert l.ll_getitem_fast(0) == 2
     l.ll_setitem_fast(0, 3)
     assert l.ll_getitem_fast(0) == 3

Modified: pypy/dist/pypy/rpython/ootypesystem/test/test_oortype.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/test/test_oortype.py	(original)
+++ pypy/dist/pypy/rpython/ootypesystem/test/test_oortype.py	Tue Apr 18 16:03:41 2006
@@ -110,24 +110,24 @@
     rettype = g.getreturnvar().concretetype
     assert rettype == Signed
 
-def test_list_append():
-    LT = List(Signed)
-
-    def oof():
-        l = new(LT)
-        l.append(1)
-        return l.ll_length()
+##def test_list_append():
+##    LT = List(Signed)
 
-    g = gengraph(oof, [])
-    rettype = g.getreturnvar().concretetype
-    assert rettype == Signed
+##    def oof():
+##        l = new(LT)
+##        l.append(1)
+##        return l.ll_length()
+
+##    g = gengraph(oof, [])
+##    rettype = g.getreturnvar().concretetype
+##    assert rettype == Signed
 
 def test_list_getitem_setitem():
     LT = List(Signed)
 
     def oof():
         l = new(LT)
-        l.append(1)
+        l._ll_resize(1)
         l.ll_setitem_fast(0, 2)
         return l.ll_getitem_fast(0)
 
@@ -165,6 +165,6 @@
         return lst.ll_length()
 
     lst = new(LIST)
-    lst.append(1)
+    lst._ll_resize(1)
     res = interpret(oof, [lst], type_system='ootype')
     assert res == 1



More information about the Pypy-commit mailing list