mirror of
https://github.com/python/cpython.git
synced 2025-07-28 21:55:21 +00:00
SF #1693079: Cannot save empty array in shelve
This commit is contained in:
parent
5447850f6f
commit
e6e660bde3
2 changed files with 28 additions and 6 deletions
|
@ -111,6 +111,21 @@ class BaseTest(unittest.TestCase):
|
|||
self.assertEqual(a.x, b.x)
|
||||
self.assertEqual(type(a), type(b))
|
||||
|
||||
def test_pickle_for_empty_array(self):
|
||||
for protocol in (0, 1, 2):
|
||||
a = array.array(self.typecode)
|
||||
b = loads(dumps(a, protocol))
|
||||
self.assertNotEqual(id(a), id(b))
|
||||
self.assertEqual(a, b)
|
||||
|
||||
a = ArraySubclass(self.typecode)
|
||||
a.x = 10
|
||||
b = loads(dumps(a, protocol))
|
||||
self.assertNotEqual(id(a), id(b))
|
||||
self.assertEqual(a, b)
|
||||
self.assertEqual(a.x, b.x)
|
||||
self.assertEqual(type(a), type(b))
|
||||
|
||||
def test_insert(self):
|
||||
a = array.array(self.typecode, self.example)
|
||||
a.insert(0, self.example[0])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue