mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Implemented list batching in cPickle.
This commit is contained in:
parent
eea4718e81
commit
1092d64002
3 changed files with 122 additions and 48 deletions
|
@ -672,23 +672,6 @@ class AbstractPickleTests(unittest.TestCase):
|
|||
self.produce_global_ext(0x7fffffff, pickle.EXT4) # largest EXT4 code
|
||||
self.produce_global_ext(0x12abcdef, pickle.EXT4) # check endianness
|
||||
|
||||
# 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)
|
||||
|
||||
def test_list_chunking(self):
|
||||
n = 10 # too small to chunk
|
||||
x = range(n)
|
||||
|
@ -711,6 +694,23 @@ class TempAbstractPickleTests(unittest.TestCase):
|
|||
else:
|
||||
self.failUnless(num_appends >= 2)
|
||||
|
||||
# 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)
|
||||
|
||||
def test_dict_chunking(self):
|
||||
n = 10 # too small to chunk
|
||||
x = dict.fromkeys(range(n))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue