diff options
author | Guido van Rossum <guido@python.org> | 2007-05-15 19:52:52 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-05-15 19:52:52 (GMT) |
commit | c4afa10c2e436c8c85809055f5f3606c987a232b (patch) | |
tree | cbd22e9105123981e105b45cbb15761345bada9a /Lib/test | |
parent | 1bc535dc7854b6be009a6bf3413a3a470e3fe749 (diff) | |
download | cpython-c4afa10c2e436c8c85809055f5f3606c987a232b.zip cpython-c4afa10c2e436c8c85809055f5f3606c987a232b.tar.gz cpython-c4afa10c2e436c8c85809055f5f3606c987a232b.tar.bz2 |
Fix the picklevalue test; it broke due to the change in default protocol.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_bool.py | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/Lib/test/test_bool.py b/Lib/test/test_bool.py index 5dc71cc..3788f08 100644 --- a/Lib/test/test_bool.py +++ b/Lib/test/test_bool.py @@ -299,19 +299,25 @@ class BoolTest(unittest.TestCase): def test_picklevalues(self): # Test for specific backwards-compatible pickle values import pickle - self.assertEqual(pickle.dumps(True), "I01\n.") - self.assertEqual(pickle.dumps(False), "I00\n.") - self.assertEqual(pickle.dumps(True, True), "I01\n.") - self.assertEqual(pickle.dumps(False, True), "I00\n.") - + self.assertEqual(pickle.dumps(True, protocol=0), b"I01\n.") + self.assertEqual(pickle.dumps(False, protocol=0), b"I00\n.") + self.assertEqual(pickle.dumps(True, protocol=1), b"I01\n.") + self.assertEqual(pickle.dumps(False, protocol=1), b"I00\n.") + self.assertEqual(pickle.dumps(True, protocol=2), b'\x80\x02\x88.') + self.assertEqual(pickle.dumps(False, protocol=2), b'\x80\x02\x89.') + + def test_cpicklevalues(self): + # Test for specific backwards-compatible pickle values try: import cPickle except ImportError: return # Just ignore the rest if cPickle doesn't exist - self.assertEqual(cPickle.dumps(True), "I01\n.") - self.assertEqual(cPickle.dumps(False), "I00\n.") - self.assertEqual(cPickle.dumps(True, True), "I01\n.") - self.assertEqual(cPickle.dumps(False, True), "I00\n.") + self.assertEqual(cPickle.dumps(True, protocol=0), b"I01\n.") + self.assertEqual(cPickle.dumps(False, protocol=0), b"I00\n.") + self.assertEqual(cPickle.dumps(True, protocol=1), b"I01\n.") + self.assertEqual(cPickle.dumps(False, protocol=1), b"I00\n.") + self.assertEqual(cPickle.dumps(True, protocol=2), b'\x80\x02\x88.') + self.assertEqual(cPickle.dumps(False, protocol=2), b'\x80\x02\x89.') def test_convert_to_bool(self): # Verify that TypeError occurs when bad things are returned |