Implemented proto 2 NEWTRUE and NEWFALSE in cPickle.

This commit is contained in:
Tim Peters 2003-02-02 17:59:11 +00:00
parent d156c2d782
commit 3c67d795ef
2 changed files with 40 additions and 2 deletions

View file

@ -502,6 +502,12 @@ class AbstractPickleTests(unittest.TestCase):
y = self.loads(s)
self.assert_(x is y, (proto, x, s, y))
# Test that proto >= 2 really uses the bool opcodes.
if proto >= 2 and x in (False, True):
expected = x and pickle.NEWTRUE or pickle.NEWFALSE
# Skip the PROTO opcode at the start.
self.assertEqual(s[2], expected)
def test_newobj_tuple(self):
x = MyTuple([1, 2, 3])
x.foo = 42