[Zope-Checkins] CVS: Zope3/lib/python/Zope/ContextWrapper - test_wrapper.py:1.6.2.1

Fred Drake Jr fdrake@acm.org
Wed, 28 Nov 2001 15:13:03 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/ContextWrapper
In directory cvs.zope.org:/tmp/cvs-serv31540/ContextWrapper

Modified Files:
      Tag: Zope-3x-branch
	test_wrapper.py 
Log Message:
Add tests for the __class__ and pickle-prevention changes to Wrapper.

=== Zope3/lib/python/Zope/ContextWrapper/test_wrapper.py 1.6 => 1.6.2.1 ===
+import pickle
 import sys
 import unittest
 
-sys.path.append('build/lib.%s-%s'
-                % (distutils.util.get_platform(), sys.version[:3]))
-
 import wrapper
 
 
@@ -125,6 +122,16 @@
         context = object()
         wrapper.setcontext(w, context)
         self.assert_(wrapper.getcontext(w) is context)
+
+    def test___class__(self):
+        o = object()
+        w = wrapper.Wrapper(o)
+        self.assert_(w.__class__ is o.__class__)
+
+    def test_pickle_prevention(self):
+        w = wrapper.Wrapper(Thing())
+        self.assertRaises(pickle.PicklingError,
+                          pickle.dumps, w)
 
 
 def test_suite():