summaryrefslogtreecommitdiffstats
path: root/Lib/test/pickletester.py
diff options
context:
space:
mode:
authorAlexandre Vassalotti <alexandre@peadrop.com>2008-06-12 18:26:05 (GMT)
committerAlexandre Vassalotti <alexandre@peadrop.com>2008-06-12 18:26:05 (GMT)
commitca2d610dba5711823999c4751897160f138a7811 (patch)
tree2f1e8b2a6c3205c21dcf26ba74787826ed02c59f /Lib/test/pickletester.py
parent829b99195dade3e835cf50117963cd5b33073717 (diff)
downloadcpython-ca2d610dba5711823999c4751897160f138a7811.zip
cpython-ca2d610dba5711823999c4751897160f138a7811.tar.gz
cpython-ca2d610dba5711823999c4751897160f138a7811.tar.bz2
Restore _pickle module accelerator module.
Removed Windows support temporarily. 64bit bug with integer unpickling is now fixed.
Diffstat (limited to 'Lib/test/pickletester.py')
-rw-r--r--Lib/test/pickletester.py25
1 files changed, 13 insertions, 12 deletions
diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py
index 783d361..c9ebdb8 100644
--- a/Lib/test/pickletester.py
+++ b/Lib/test/pickletester.py
@@ -362,7 +362,7 @@ def create_data():
return x
class AbstractPickleTests(unittest.TestCase):
- # Subclass must define self.dumps, self.loads, self.error.
+ # Subclass must define self.dumps, self.loads.
_testdata = create_data()
@@ -463,8 +463,9 @@ class AbstractPickleTests(unittest.TestCase):
self.assertEqual(list(x[0].attr.keys()), [1])
self.assert_(x[0].attr[1] is x)
- def test_garyp(self):
- self.assertRaises(self.error, self.loads, b'garyp')
+ def test_get(self):
+ self.assertRaises(KeyError, self.loads, b'g0\np0')
+ self.assertEquals(self.loads(b'((Kdtp0\nh\x00l.))'), [(100,), (100,)])
def test_insecure_strings(self):
# XXX Some of these tests are temporarily disabled
@@ -955,7 +956,7 @@ class AbstractPickleModuleTests(unittest.TestCase):
f = open(TESTFN, "wb")
try:
f.close()
- self.assertRaises(ValueError, self.module.dump, 123, f)
+ self.assertRaises(ValueError, pickle.dump, 123, f)
finally:
os.remove(TESTFN)
@@ -964,24 +965,24 @@ class AbstractPickleModuleTests(unittest.TestCase):
f = open(TESTFN, "wb")
try:
f.close()
- self.assertRaises(ValueError, self.module.dump, 123, f)
+ self.assertRaises(ValueError, pickle.dump, 123, f)
finally:
os.remove(TESTFN)
def test_highest_protocol(self):
# Of course this needs to be changed when HIGHEST_PROTOCOL changes.
- self.assertEqual(self.module.HIGHEST_PROTOCOL, 3)
+ self.assertEqual(pickle.HIGHEST_PROTOCOL, 3)
def test_callapi(self):
from io import BytesIO
f = BytesIO()
# With and without keyword arguments
- self.module.dump(123, f, -1)
- self.module.dump(123, file=f, protocol=-1)
- self.module.dumps(123, -1)
- self.module.dumps(123, protocol=-1)
- self.module.Pickler(f, -1)
- self.module.Pickler(f, protocol=-1)
+ pickle.dump(123, f, -1)
+ pickle.dump(123, file=f, protocol=-1)
+ pickle.dumps(123, -1)
+ pickle.dumps(123, protocol=-1)
+ pickle.Pickler(f, -1)
+ pickle.Pickler(f, protocol=-1)
class AbstractPersistentPicklerTests(unittest.TestCase):