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

Casey Duncan casey at zope.com
Thu May 13 00:33:41 EDT 2004


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

Modified Files:
	test_query.py 
Log Message:
Allow joins on non-hashable values


=== Packages/pypes/pypes/tests/test_query.py 1.10 => 1.11 ===
--- Packages/pypes/pypes/tests/test_query.py:1.10	Wed May 12 01:10:36 2004
+++ Packages/pypes/pypes/tests/test_query.py	Thu May 13 00:33:39 2004
@@ -272,6 +272,14 @@
         for left, right in joined:
             self.assertEqual(left.age, right.age)
             
+    def test_equijoin_not_hashable(self):
+        from pypes.query import equijoin
+        left = ['a', 'bc', ['s','a'], []]
+        right = ['bc', ['s','a'], ['yo']]
+        joined = list(equijoin(left, lambda x: x, right, lambda x: x))
+        self.assertEqual(
+            sort(joined), sort([('bc','bc'), (['s','a'],['s','a'])]))
+            
     def test_equijoin_empty(self):
         from pypes.query import equijoin
         joined = equijoin([], lambda x:x, [], lambda x:x)
@@ -387,6 +395,15 @@
         objs = [TestClass() for i in range(5)]
         joined = injoin(objs, lambda x: 1, objs, lambda x: [])
         self.failIf(list(joined))
+            
+    def test_injoin_not_hashable(self):
+        from pypes.query import injoin
+        left = ['a', ['yo'], ['s','a'], []]
+        right = ['bc', [['s','a'], ['yo']]]
+        joined = list(injoin(left, lambda x: x, right, lambda x: x))
+        self.assertEqual(
+            sort(joined), sort([(['yo'],[['s','a'], ['yo']]), 
+                                (['s','a'],[['s','a'], ['yo']])]))
 
 
 class TestJoin(unittest.TestCase):




More information about the Zope-CVS mailing list