diff options
author | Raymond Hettinger <python@rcn.com> | 2007-04-02 17:29:30 +0000 |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2007-04-02 17:29:30 +0000 |
commit | e6e660bde384b21ee41a5b9f6dbbd2bc1bb2ae6b (patch) | |
tree | c5e3fc664ea594af562e90a49537f7e0219e7fa3 /Lib/test/test_array.py | |
parent | 5447850f6fec4445c0a2a84a5364e7c52940e8c9 (diff) | |
download | cpython-git-e6e660bde384b21ee41a5b9f6dbbd2bc1bb2ae6b.tar.gz |
SF #1693079: Cannot save empty array in shelve
Diffstat (limited to 'Lib/test/test_array.py')
-rwxr-xr-x | Lib/test/test_array.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py index 63e7f4ebb6..597f3b2421 100755 --- a/Lib/test/test_array.py +++ b/Lib/test/test_array.py @@ -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]) |