cpython/Lib/test/test_json/test_pickleable.py
Miss Islington (bot) 539bb54500
[3.15] Test object_hook and pickleability of some JSON components (GH-154155) (#154374)
Test `object_hook` and pickleability of some JSON components (GH-154155)
(cherry picked from commit d333e5aa59)

Co-authored-by: David <slavicek.david29@gmail.com>
2026-07-22 10:02:31 +02:00

14 lines
417 B
Python

import json
import pickle
import unittest
class TestPickleable(unittest.TestCase):
def test_json_decode_error_is_pickleable(self):
e = json.JSONDecodeError(msg="abc", doc="def", pos=7)
pickled = pickle.dumps(e)
unpickled = pickle.loads(pickled)
self.assertEqual(unpickled.msg, e.msg)
self.assertEqual(unpickled.doc, e.doc)
self.assertEqual(unpickled.pos, e.pos)