improve json test coverage (GH-154123)

encukou <[email protected]>
Newsgroups gmane.comp.python.cvs
Message-ID <[email protected]>
https://github.com/python/cpython/commit/ee1e48ebd8194cd5984714021c4df85dbb93c6df
commit: ee1e48ebd8194cd5984714021c4df85dbb93c6df
branch: main
author: David <[email protected]>
committer: encukou <[email protected]>
date: 2026-07-19T13:19:00Z
summary:

improve json test coverage (GH-154123)

Add test that covers the except block on line 106 of decoder.py

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.