[Zope-Checkins] CVS: Zope3/lib/python/Zope/ContextWrapper - test_wrapper.py:1.6.2.7
Fred Drake Jr
fdrake@acm.org
Sat, 1 Dec 2001 15:28:18 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/ContextWrapper
In directory cvs.zope.org:/tmp/cvs-serv1149
Modified Files:
Tag: Zope-3x-branch
test_wrapper.py
Log Message:
Add tests to check the two-arg form of the constructor and the support for
keyword args in the constructor, ensuring use of keyword it does not break
the behaviors of the getdict() and getdictcreate() functions.
=== Zope3/lib/python/Zope/ContextWrapper/test_wrapper.py 1.6.2.6 => 1.6.2.7 ===
self.assert_(wrapper.getobject(w) is o2)
+ # test 2-argument version of constructor
+ o = object()
+ w = wrapper.Wrapper(o, c)
+ self.assert_(wrapper.getobject(w) is o)
+ self.assert_(wrapper.getcontext(w) is c)
+
def test_wrapper_attributes(self):
o = Thing()
o.foo = 1
@@ -148,6 +154,13 @@
self.assert_(wrapper.getdict(w) is d)
self.assert_(wrapper.getdictcreate(w) is d)
self.assert_(wrapper.getdict(w) is d)
+
+ w = wrapper.Wrapper(None, name="myobject")
+ d = wrapper.getdict(w)
+ self.assert_(d is not None)
+ self.assert_(wrapper.getdictcreate(w) is d)
+ self.assert_(wrapper.getdictcreate(w) is d)
+ self.assert_(len(d) == 1)
def test_setobject(self):
obj1 = object()