[Python-checkins] python/dist/src/Lib/test pickletester.py,1.51,1.52 test_pickle.py,1.16,1.17

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
Fri, 14 Feb 2003 19:01:45 -0800


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv13821/python/Lib/test

Modified Files:
	pickletester.py test_pickle.py 
Log Message:
cPickle.c, load_build():  Taught cPickle how to pick apart
the optional proto 2 slot state.

pickle.py, load_build():  CAUTION:  Noted that cPickle's
load_build and pickle's load_build really don't do the same
things with the state, and didn't before this patch either.
cPickle never tries to do .update(), and has no backoff if
instance.__dict__ can't be retrieved.  There are no tests
that can tell the difference, and part of what cPickle's
load_build() did looked accidental to me, so I don't know
what the true intent is here.

pickletester.py, test_pickle.py:  Got rid of the hack for
exempting cPickle from running some of the proto 2 tests.

dictobject.c, PyDict_Next():  documented intended use.


Index: pickletester.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/pickletester.py,v
retrieving revision 1.51
retrieving revision 1.52
diff -C2 -d -r1.51 -r1.52
*** pickletester.py	14 Feb 2003 23:05:26 -0000	1.51
--- pickletester.py	15 Feb 2003 03:01:09 -0000	1.52
***************
*** 729,738 ****
              self.assertEqual(x.__dict__, y.__dict__)
  
- # XXX Temporary hack, so long as the C implementation of pickle protocol
- # XXX 2 isn't ready.  When it is, move the methods in TempAbstractPickleTests
- # XXX into AbstractPickleTests above, and get rid of TempAbstractPickleTests
- # XXX along with the references to it in test_pickle.py.
- class TempAbstractPickleTests(unittest.TestCase):
- 
      def test_newobj_list_slots(self):
          x = SlotList([1, 2, 3])
--- 729,732 ----
***************
*** 745,748 ****
--- 739,743 ----
          self.assertEqual(x.foo, y.foo)
          self.assertEqual(x.bar, y.bar)
+ 
  
  class MyInt(int):

Index: test_pickle.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pickle.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** test_pickle.py	30 Jan 2003 21:27:37 -0000	1.16
--- test_pickle.py	15 Feb 2003 03:01:09 -0000	1.17
***************
*** 6,14 ****
  
  from test.pickletester import AbstractPickleTests
- from test.pickletester import TempAbstractPickleTests as XXXTemp
  from test.pickletester import AbstractPickleModuleTests
  from test.pickletester import AbstractPersistentPicklerTests
  
! class PickleTests(AbstractPickleTests, AbstractPickleModuleTests, XXXTemp):
  
      def dumps(self, arg, proto=0, fast=0):
--- 6,13 ----
  
  from test.pickletester import AbstractPickleTests
  from test.pickletester import AbstractPickleModuleTests
  from test.pickletester import AbstractPersistentPicklerTests
  
! class PickleTests(AbstractPickleTests, AbstractPickleModuleTests):
  
      def dumps(self, arg, proto=0, fast=0):