diff options
author | Tim Peters <tim.peters@gmail.com> | 2003-02-04 20:56:09 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2003-02-04 20:56:09 (GMT) |
commit | 731098b3ff6e37cc0950397a0e2bd868f4d6ff86 (patch) | |
tree | e684bec71fcca4f01475091218377372b18158f3 /Lib/test/pickletester.py | |
parent | 7fe16e79f569d24fcfe8436021c027e307cd2de2 (diff) | |
download | cpython-731098b3ff6e37cc0950397a0e2bd868f4d6ff86.zip cpython-731098b3ff6e37cc0950397a0e2bd868f4d6ff86.tar.gz cpython-731098b3ff6e37cc0950397a0e2bd868f4d6ff86.tar.bz2 |
cPickle now generates proto 2 EXT[124] when appropriate.
Moved such EXT tests as currently exist from TempAbstractPickleTests to
AbstractPickleTests, so that test_cpickle runs them too.
Diffstat (limited to 'Lib/test/pickletester.py')
-rw-r--r-- | Lib/test/pickletester.py | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py index 87acec6..c6e5494 100644 --- a/Lib/test/pickletester.py +++ b/Lib/test/pickletester.py @@ -583,23 +583,6 @@ class AbstractPickleTests(unittest.TestCase): self.assertEqual(B(x), B(y), detail) self.assertEqual(x.__dict__, y.__dict__, detail) -# 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]) - x.foo = 42 - x.bar = "hello" - s = self.dumps(x, 2) - y = self.loads(s) - self.assertEqual(list(x), list(y)) - self.assertEqual(x.__dict__, y.__dict__) - self.assertEqual(x.foo, y.foo) - self.assertEqual(x.bar, y.bar) - # Register a type with copy_reg, with extension code extcode. Pickle # an object of that type. Check that the resulting pickle uses opcode # (EXT[124]) under proto 2, and not in proto 1. @@ -638,7 +621,24 @@ class TempAbstractPickleTests(unittest.TestCase): self.produce_global_ext(0xfff0, pickle.EXT2) def test_global_ext4(self): - self.produce_global_ext(0xffffff0, pickle.EXT4) + self.produce_global_ext(0xabcdef0, pickle.EXT4) + +# 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]) + x.foo = 42 + x.bar = "hello" + s = self.dumps(x, 2) + y = self.loads(s) + self.assertEqual(list(x), list(y)) + self.assertEqual(x.__dict__, y.__dict__) + self.assertEqual(x.foo, y.foo) + self.assertEqual(x.bar, y.bar) class MyInt(int): |