[Zope-CVS] CVS: Packages/FunctionalTests - Framework.py:1.14

Tres Seaver tseaver@zope.com
Tue, 19 Mar 2002 22:23:09 -0500


Update of /cvs-repository/Packages/FunctionalTests
In directory cvs.zope.org:/tmp/cvs-serv1221

Modified Files:
	Framework.py 
Log Message:
 - Add mechanism for parsing (simplest) load sequences.

=== Packages/FunctionalTests/Framework.py 1.13 => 1.14 ===
         self._postcondition = None
         self._load_sequence = None
+        self._load_requests = None
 
     #
     #   Accessors
@@ -968,6 +969,29 @@
     def getLoadSequence( self ):
         
         return self._load_sequence
+
+    def _parseLoadSequence( self ):
+
+        if self._load_requests is None:
+            seq = self._load_sequence
+            self._load_requests = seq and seq.split() or []
+
+    def hasLoadRequests( self ):
+
+        self._parseLoadSequence()
+        return not not self._load_requests
+
+    def nextLoadRequest( self ):
+
+        self._parseLoadSequence()
+        lr = self._load_requests
+
+        if lr is None:
+            raise IndexError
+
+        result, self._load_requests = lr[0], lr[1:]
+
+        return result
 
     #
     #   Mutators