[Zope-Checkins] CVS: Zope3/lib/python/Zope/ContextWrapper/tests - testContainmentIterator.py:1.1.2.1
Jim Fulton
jim@zope.com
Fri, 28 Dec 2001 13:58:41 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/ContextWrapper/tests
In directory cvs.zope.org:/tmp/cvs-serv24687/tests
Added Files:
Tag: Zope-3x-branch
testContainmentIterator.py
Log Message:
Added containment iterators for wrapped objects.
=== Added File Zope3/lib/python/Zope/ContextWrapper/tests/testContainmentIterator.py ===
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
import unittest, sys
from Zope.ContextWrapper import Wrapper, getbaseobject
from Zope.ContextWrapper.ContainmentIterator import ContainmentIterator
class Test(unittest.TestCase):
def testItAll(self):
ob1 = 1
ob2 = 2
ob3 = 3
ob4 = 4
ob = Wrapper(Wrapper(ob3, Wrapper(ob2, ob1)), ob4)
self.assertEqual(map(getbaseobject, ContainmentIterator(ob)), [ 3, 2, 1 ])
def test_suite():
loader=unittest.TestLoader()
return loader.loadTestsFromTestCase(Test)
if __name__=='__main__':
unittest.TextTestRunner().run(test_suite())