[Zope3-checkins] CVS: Zope3/src/zope/context/tests - test_wrapper.py:1.19

Jim Fulton jim@zope.com
Mon, 2 Jun 2003 07:06:58 -0400


Update of /cvs-repository/Zope3/src/zope/context/tests
In directory cvs.zope.org:/tmp/cvs-serv20175/src/zope/context/tests

Modified Files:
	test_wrapper.py 
Log Message:
Moved the tests for non-pickleability of context wrappers to 
test_context.


=== Zope3/src/zope/context/tests/test_wrapper.py 1.18 => 1.19 ===
--- Zope3/src/zope/context/tests/test_wrapper.py:1.18	Sun Jun  1 11:59:40 2003
+++ Zope3/src/zope/context/tests/test_wrapper.py	Mon Jun  2 07:06:57 2003
@@ -14,9 +14,7 @@
 """
 $Id$
 """
-import pickle
 import unittest
-
 from zope.proxy import getProxiedObject
 from zope.context import Wrapper, wrapper
 from zope.context import ContextMethod, ContextProperty, ContextAware
@@ -513,29 +511,6 @@
         context = object()
         wrapper.setcontext(w, context)
         self.assert_(wrapper.getcontext(w) is context)
-
-    def test_pickle_prevention(self):
-        w = self.new_proxy(Thing())
-        self.assertRaises(pickle.PicklingError,
-                          pickle.dumps, w)
-        try:
-            pickle.dumps(w)
-        except pickle.PicklingError, err:
-            # We need to check that the error is the one raised by the
-            # Wrapper's __reduce__ method, and not one caused by the pickling
-            # machinery getting confused.
-            self.assertEquals(err[0], "Wrapper instances cannot be pickled.")
-
-    def test_reduce_in_subclass(self):
-        class CustomPicklingError(pickle.PicklingError):
-            pass
-        class WrapperWithReduce(self.proxy_class):
-            def __reduce__(self):
-                raise CustomPicklingError
-            def __reduce_ex__(self, proto):
-                raise CustomPicklingError
-        w = WrapperWithReduce(Thing())
-        self.assertRaises(CustomPicklingError, pickle.dumps, w)
 
     def test_simple_subclass(self):