[Zope-CVS] CVS: Packages/ContextWrapper - test_wrapper.py:1.1
Fred Drake Jr
fdrake@acm.org
Mon, 12 Nov 2001 19:37:29 -0500
Update of /cvs-repository/Packages/ContextWrapper
In directory cvs.zope.org:/tmp/cvs-serv10282
Added Files:
test_wrapper.py
Log Message:
Preliminary tests; not yet a "proper" Zopish test.
=== Added File Packages/ContextWrapper/test_wrapper.py ===
import sys
import distutils.util
sys.path.append('build/lib.%s-%s'
% (distutils.util.get_platform(), sys.version[:3]))
import wrapper
def testit(o, o2, type):
w = type(o)
print w
print wrapper.getobject(w)
print "match:", o is wrapper.getobject(w)
print wrapper.getdict(w)
d = wrapper.getdictcreate(w)
print d
print wrapper.getdictcreate(w) is d
print "context:", wrapper.getcontext(w)
c = 'context'
wrapper.setcontext(w, c)
print `wrapper.getcontext(w)`
print wrapper.getcontext(w) is c
wrapper.setcontext(w, None)
print `wrapper.getcontext(w)`
print wrapper.getcontext(w) is None
wrapper.setobject(w, o2)
print wrapper.getobject(w)
testit(1, 12, wrapper.WrapperType)
testit(2, 24, wrapper.new)
testit(lambda: 3, lambda: 36, wrapper.CallableWrapperType)