[conduit: 59/138] I like iterators



commit ec2a9521af6ddc455f7c900d41c9db0914f5216f
Author: John Carr <john carr unrouted co uk>
Date:   Thu Apr 30 14:30:15 2009 -0700

    I like iterators
---
 test/soup/__init__.py |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/test/soup/__init__.py b/test/soup/__init__.py
index 31b8a95..782f28c 100644
--- a/test/soup/__init__.py
+++ b/test/soup/__init__.py
@@ -185,12 +185,11 @@ class TestLoader(unittest.TestLoader):
 
     def _flatten(self, tests):
         if isinstance(tests, unittest.TestSuite):
-            res = []
             for test in tests:
-                res.extend(self._flatten(test))
-            return res
+                for subtest in self._flatten(test):
+                    yield subtest
         else:
-            return [tests]
+            yield tests
 
     def loadTestsFromModule(self, module):
         return self._flatten(super(TestLoader, self).loadTestsFromModule(module))



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]