https://github.com/python/cpython/commit/303d0acfcdcc2f505c11ad7ffa435594c4e0dcee commit: 303d0acfcdcc2f505c11ad7ffa435594c4e0dcee branch: 3.13 author: Miss Islington (bot) <[email protected]> committer: tomasr8 <[email protected]> date: 2026-07-19T12:22:33Z summary:
[3.13] Add test for explicit `cls` argument bypassing default JSON decoder (GH-154094) (#154114) Add test for explicit `cls` argument bypassing default JSON decoder (GH-154094) * Add test for skipped `cls=None` case * Fix lint * Add new line between classes (cherry picked from commit 5380589615515fa9e2c48820073a3fd8e32a930d) Co-authored-by: Dominic H <[email protected]> files: M Lib/test/test_json/test_decode.py diff --git a/Lib/test/test_json/test_decode.py b/Lib/test/test_json/test_decode.py index 2250af964c022bf..e46f19712953546 100644 --- a/Lib/test/test_json/test_decode.py +++ b/Lib/test/test_json/test_decode.py @@ -1,4 +1,5 @@ import decimal +import unittest.mock from io import StringIO from collections import OrderedDict from test.test_json import PyTest, CTest @@ -130,6 +131,15 @@ def test_limit_int(self): with self.assertRaises(ValueError): self.loads('1' * (maxdigits + 1)) + def test_explicit_cls_skips_json_decoder_default(self): + class CustomDecoder: + pass + + with unittest.mock.patch.object( + CustomDecoder, 'decode', create=True) as mock_decode: + self.loads('{}', cls=CustomDecoder) + mock_decode.assert_called_once() + class TestPyDecode(TestDecode, PyTest): pass class TestCDecode(TestDecode, CTest): pass _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
