[pypy-svn] rev 999 - in pypy/trunk/src/pypy/objspace/std: . test

tismer at codespeak.net tismer at codespeak.net
Mon Jun 23 16:44:33 CEST 2003


Author: tismer
Date: Mon Jun 23 16:44:33 2003
New Revision: 999

Modified:
   pypy/trunk/src/pypy/objspace/std/iterobject.py
   pypy/trunk/src/pypy/objspace/std/itertype.py
   pypy/trunk/src/pypy/objspace/std/test/test_iterobject.py
Log:
reviewed, refactored some tests, very good and complete

Modified: pypy/trunk/src/pypy/objspace/std/iterobject.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/std/iterobject.py	(original)
+++ pypy/trunk/src/pypy/objspace/std/iterobject.py	Mon Jun 23 16:44:33 2003
@@ -1,3 +1,9 @@
+"""
+Reviewed 03-06-22
+Sequence-iteration is correctly implemented, thoroughly
+tested, and complete. The only missing feature is support
+for function-iteration.
+"""
 from pypy.objspace.std.objspace import *
 from itertype import W_SeqIterType
 

Modified: pypy/trunk/src/pypy/objspace/std/itertype.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/std/itertype.py	(original)
+++ pypy/trunk/src/pypy/objspace/std/itertype.py	Mon Jun 23 16:44:33 2003
@@ -1,3 +1,6 @@
+"""
+Reviewed 03-06-22
+"""
 from pypy.objspace.std.objspace import *
 from typeobject import W_TypeObject
 

Modified: pypy/trunk/src/pypy/objspace/std/test/test_iterobject.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/std/test/test_iterobject.py	(original)
+++ pypy/trunk/src/pypy/objspace/std/test/test_iterobject.py	Mon Jun 23 16:44:33 2003
@@ -11,21 +11,38 @@
     def tearDown(self):
         pass
 
-    def test_iter(self):
+    def body3(self, w_iter):
         w = self.space.wrap
-        w_tuple = self.space.newtuple([w(5), w(3), w(99)])
-        w_iter = W_SeqIterObject(self.space, w_tuple)
         self.assertEqual_w(self.space.next(w_iter), w(5))
         self.assertEqual_w(self.space.next(w_iter), w(3))
         self.assertEqual_w(self.space.next(w_iter), w(99))
+        self.body0(w_iter)
+
+    def body0(self, w_iter):
         self.assertRaises(NoValue, self.space.next, w_iter)
         self.assertRaises(NoValue, self.space.next, w_iter)
 
+    def test_iter(self):
+        w = self.space.wrap
+        w_tuple = self.space.newtuple([w(5), w(3), w(99)])
+        w_iter = W_SeqIterObject(self.space, w_tuple)
+        self.body3(w_iter)
+        
+    def test_iter_builtin(self):
+        w = self.space.wrap
+        w_tuple = self.space.newtuple([w(5), w(3), w(99)])
+        w_iter = self.space.iter(w_tuple)
+        self.body3(w_iter)
+
     def test_emptyiter(self):
         w_list = self.space.newlist([])
         w_iter = W_SeqIterObject(self.space, w_list)
-        self.assertRaises(NoValue, self.space.next, w_iter)
-        self.assertRaises(NoValue, self.space.next, w_iter)
+        self.body0(w_iter)
+        
+    def test_emptyiter_builtin(self):
+        w_list = self.space.newlist([])
+        w_iter = self.space.iter(w_list)
+        self.body0(w_iter)
 
 if __name__ == '__main__':
     test.main()


More information about the Pypy-commit mailing list