[Zope-CVS] CVS: Packages/pypes/pypes/tests - test_query.py:1.4

Casey Duncan casey at zope.com
Mon Apr 12 21:03:08 EDT 2004


Update of /cvs-repository/Packages/pypes/pypes/tests
In directory cvs.zope.org:/tmp/cvs-serv6214/tests

Modified Files:
	test_query.py 
Log Message:
rename scan => xproduct


=== Packages/pypes/pypes/tests/test_query.py 1.3 => 1.4 ===
--- Packages/pypes/pypes/tests/test_query.py:1.3	Sun Apr  4 00:27:10 2004
+++ Packages/pypes/pypes/tests/test_query.py	Mon Apr 12 21:03:06 2004
@@ -47,66 +47,66 @@
         return self._func(*args, **kw)
 
 
-class TestScanner(unittest.TestCase):
+class TestXProduct(unittest.TestCase):
     
     def setUp(self):
         self.foos = [TestClass(foo=i) for i in range(10)]
         self.bars = [TestClass(bar=chr(i+65)) for i in range(26)]
     
-    def test_scan_one_input(self):
-        from pypes.query import scan
-        rows = [row.copy() for row in scan(foo=self.foos)]
+    def test_xproduct_one_input(self):
+        from pypes.query import xproduct
+        rows = [row.copy() for row in xproduct(foo=self.foos)]
         for foo, row in zip(self.foos, rows):
             self.assertEqual(len(row), 1)
             self.failUnless(row['foo'] is foo)
     
-    def test_scan_one_self_named_input(self):
-        from pypes.query import scan
+    def test_xproduct_one_self_named_input(self):
+        from pypes.query import xproduct
         from UserList import UserList     
         foos = UserList(self.foos)
         foos.__name__ = 'yahoozie'
-        rows = [row.copy() for row in scan(foos)]
+        rows = [row.copy() for row in xproduct(foos)]
         for foo, row in zip(self.foos, rows):
             self.assertEqual(len(row), 1)
             self.failUnless(row['yahoozie'] is foo)
 
-    def test_scan_unnamed_fails(self):
-        from pypes.query import scan
+    def test_xproduct_unnamed_fails(self):
+        from pypes.query import xproduct
         from pypes.exceptions import PypesQueryInputError
-        rows = scan(self.foos)
+        rows = xproduct(self.foos)
         self.assertRaises(PypesQueryInputError, list, rows)
 
-    def test_scan_with_dupe_names_fails(self):
-        from pypes.query import scan
+    def test_xproduct_with_dupe_names_fails(self):
+        from pypes.query import xproduct
         from pypes.exceptions import PypesQueryInputError
         from UserList import UserList     
         foos = UserList(self.foos)
         foos.__name__ = 'johndoe'     
         bars = UserList(self.bars)
         bars.__name__ = 'johndoe'
-        rows = scan(foos, bars)
+        rows = xproduct(foos, bars)
         self.assertRaises(PypesQueryInputError, list, rows)
-        rows = scan(bars, johndoe=foos)
+        rows = xproduct(bars, johndoe=foos)
         self.assertRaises(PypesQueryInputError, list, rows)
     
-    def test_scan_multiple_inputs(self):
+    def test_xproduct_multiple_inputs(self):
         from sets import Set
-        from pypes.query import scan
-        rows = [row.copy() for row in scan(foo=self.foos, bar=self.bars)]
+        from pypes.query import xproduct
+        rows = [row.copy() for row in xproduct(foo=self.foos, bar=self.bars)]
         self.assertEqual(len(rows), len(self.foos) * len(self.bars))
         expected = [{'foo':foo, 'bar':bar} 
                     for foo in self.foos for bar in self.bars]
         self.assertEqual(sort(rows), sort(expected))
     
-    def test_scan_multiple_self_named_inputs(self):
+    def test_xproduct_multiple_self_named_inputs(self):
         from sets import Set
-        from pypes.query import scan
+        from pypes.query import xproduct
         from UserList import UserList
         foos = UserList(self.foos)
         foos.__name__ = 'yup'     
         bars = UserList(self.bars)
         bars.__name__ = 'nope'
-        rows = [row.copy() for row in scan(foos, bars)]
+        rows = [row.copy() for row in xproduct(foos, bars)]
         self.assertEqual(len(rows), len(self.foos) * len(self.bars))
         expected = [{'yup':foo, 'nope':bar} 
                     for foo in self.foos for bar in self.bars]




More information about the Zope-CVS mailing list