MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_proto

Method test_proto

Lib/test/pickletester.py:3071–3088  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3069 # Tests for protocol 2
3070
3071 def test_proto(self):
3072 for proto in protocols:
3073 pickled = self.dumps(None, proto)
3074 if proto >= 2:
3075 proto_header = pickle.PROTO + bytes([proto])
3076 self.assertStartsWith(pickled, proto_header)
3077 else:
3078 self.assertEqual(count_opcode(pickle.PROTO, pickled), 0)
3079
3080 oob = protocols[-1] + 1 # a future protocol
3081 build_none = pickle.NONE + pickle.STOP
3082 badpickle = pickle.PROTO + bytes([oob]) + build_none
3083 try:
3084 self.loads(badpickle)
3085 except ValueError as err:
3086 self.assertIn("unsupported pickle protocol", str(err))
3087 else:
3088 self.fail("expected bad protocol number to raise ValueError")
3089
3090 def test_long1(self):
3091 x = 12345678910111213141516178920

Callers

nothing calls this directly

Calls 8

count_opcodeFunction · 0.85
strFunction · 0.85
assertInMethod · 0.80
dumpsMethod · 0.45
assertStartsWithMethod · 0.45
assertEqualMethod · 0.45
loadsMethod · 0.45
failMethod · 0.45

Tested by

no test coverage detected