[3.15] improve json test coverage (GH-154123) (GH-154134)

encukou <[email protected]>
Newsgroups gmane.comp.python.cvs
Message-ID <[email protected]>
https://github.com/python/cpython/commit/618f4ec98c4306d0ee5f071df17a9828240b3f5e
commit: 618f4ec98c4306d0ee5f071df17a9828240b3f5e
branch: 3.15
author: Miss Islington (bot) <[email protected]>
committer: encukou <[email protected]>
date: 2026-07-19T17:16:37+02:00
summary:

[3.15] improve json test coverage (GH-154123) (GH-154134)

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 6d05ef8f8eb091..33aeefa92f282a 100644
--- a/Lib/test/test_json/test_decode.py
+++ b/Lib/test/test_json/test_decode.py
@@ -149,6 +149,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]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.