[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Traversing/tests - testZopeWrapper.py:1.1.2.1
Steve Alexander
steve@cat-box.net
Wed, 20 Mar 2002 16:25:00 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/Traversing/tests
In directory cvs.zope.org:/tmp/cvs-serv17687/tests
Added Files:
Tag: Zope-3x-branch
testZopeWrapper.py
Log Message:
corrections to ZopeWrapper and the hacking of __builtins__.
Added testZopeWrapper.py
=== Added File Zope3/lib/python/Zope/App/Traversing/tests/testZopeWrapper.py ===
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 1.1 (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.
##############################################################################
"""
$Id: testZopeWrapper.py,v 1.1.2.1 2002/03/20 21:24:59 stevea Exp $
"""
import unittest
from Zope.Testing.CleanUp import CleanUp # Base class w registry cleanup
from Zope.ContextWrapper import Wrapper, getobject
import Zope.App.Traversing
from Zope.App.Traversing import ZopeWrapper
class ZopeWrapperTests(CleanUp, unittest.TestCase):
def setUp(self):
pass
def testPrimitives(self):
for obj in None, 1,1l, 1.0, 1+2j, u'', '':
self.assertEquals(ZopeWrapper(obj) is obj, 1)
def testComplexTypes(self):
obj = object()
w = Wrapper(obj)
zw = ZopeWrapper(obj)
self.assertEquals(type(zw) is type(w), 1)
self.assertEquals(getobject(zw) is getobject(w), 1)
def test_suite():
loader = unittest.TestLoader()
suite = loader.loadTestsFromTestCase(ZopeWrapperTests)
return suite
if __name__=='__main__':
unittest.TextTestRunner().run(test_suite())