https://github.com/python/cpython/commit/6839aa8711bbeb089ee0c28e8ccf9aee436a8189
commit: 6839aa8711bbeb089ee0c28e8ccf9aee436a8189
branch: 3.14
author: Miss Islington (bot) <[email protected]>
committer: encukou <[email protected]>
date: 2026-07-19T17:16:47+02:00
summary:

[3.14] improve json test coverage (GH-154123) (GH-154135)

Add test that covers the except block on line 106 of decoder.py
(cherry picked from commit ee1e48ebd8194cd5984714021c4df85dbb93c6df)

Co-authored-by: David <[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 e46f1971295354..c8b21b8f582a7e 100644
--- a/Lib/test/test_json/test_decode.py
+++ b/Lib/test/test_json/test_decode.py
@@ -124,6 +124,10 @@ def test_negative_index(self):
         d = self.json.JSONDecoder()
         self.assertRaises(ValueError, d.raw_decode, 'a'*42, -50000)
 
+    def test_unterminated_string(self):
+        d = self.json.JSONDecoder()
+        self.assertRaises(self.JSONDecodeError, d.raw_decode, '"\\')
+
     def test_limit_int(self):
         maxdigits = 5000
         with support.adjust_int_max_str_digits(maxdigits):

_______________________________________________
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]

Reply via email to