[Zope-CVS] CVS: Packages/pypes/pypes/tests - test_identity.py:1.9
Casey Duncan
casey at zope.com
Sat Feb 21 23:19:54 EST 2004
Update of /cvs-repository/Packages/pypes/pypes/tests
In directory cvs.zope.org:/tmp/cvs-serv25771/tests
Modified Files:
test_identity.py
Log Message:
multi-set ops for identity sets now work properly when passed an iterator of sets
=== Packages/pypes/pypes/tests/test_identity.py 1.8 => 1.9 ===
--- Packages/pypes/pypes/tests/test_identity.py:1.8 Wed Feb 18 00:08:10 2004
+++ Packages/pypes/pypes/tests/test_identity.py Sat Feb 21 23:19:54 2004
@@ -633,6 +633,17 @@
union = multiUnion([set])
self.failIf(union is set)
self.assertEqual(union, set)
+
+ def testMultiUnionWithIter(self):
+ from pypes.identity import IdentitySet, multiUnion
+ sets = [IdentitySet([self._newObj() for i in range(10)])
+ for i in range(10)]
+ union = multiUnion(iter(sets))
+ self.assertEqual(len(union), 100)
+ union2 = IdentitySet()
+ for set in sets:
+ union2 = union2.union(set)
+ self.assertEqual(union, union2)
def testMultiIntersectionOverlapping(self):
from pypes.identity import IdentitySet, multiIntersection
@@ -667,7 +678,17 @@
set = IdentitySet([self._newObj() for i in range(10)])
sect = multiIntersection([set])
self.failIf(sect is set)
- self.assertEqual(sect, set)
+ self.assertEqual(sect, set)
+
+ def testMultiIntersectionWithIter(self):
+ from pypes.identity import IdentitySet, multiIntersection
+ sets = [IdentitySet([self._newObj() for i in range(10)])
+ for i in range(10)]
+ overlap = [list(set)[5] for set in sets]
+ for set in sets:
+ set.update(overlap)
+ sect = multiIntersection(iter(sets))
+ self.assertEqual(sect, IdentitySet(overlap))
class TestIdentitySetPersistence(PypesPersistentTest):
More information about the Zope-CVS
mailing list