(self)
| 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 |
nothing calls this directly
no test coverage detected