File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,6 +23,12 @@ def my_print(o):
2323my_print (json .loads ('{"a":true}' ))
2424my_print (json .loads ('{"a":null, "b":false, "c":true}' ))
2525my_print (json .loads ('{"a":[], "b":[1], "c":{"3":4}}' ))
26+ my_print (json .loads ('"abc\\ bdef"' ))
27+ my_print (json .loads ('"abc\\ fdef"' ))
28+ my_print (json .loads ('"abc\\ ndef"' ))
29+ my_print (json .loads ('"abc\\ rdef"' ))
30+ my_print (json .loads ('"abc\\ tdef"' ))
31+ my_print (json .loads ('"abc\\ uabcd"' ))
2632
2733# whitespace handling
2834my_print (json .loads ('{\n \t "a":[]\r \n , "b":[1], "c":{"3":4} \n \r \t \r \r \r \n }' ))
@@ -32,3 +38,33 @@ def my_print(o):
3238 json .loads ('' )
3339except ValueError :
3440 print ('ValueError' )
41+
42+ # string which is not closed
43+ try :
44+ my_print (json .loads ('"abc' ))
45+ except ValueError :
46+ print ('ValueError' )
47+
48+ # unaccompanied closing brace
49+ try :
50+ my_print (json .loads (']' ))
51+ except ValueError :
52+ print ('ValueError' )
53+
54+ # unspecified object type
55+ try :
56+ my_print (json .loads ('a' ))
57+ except ValueError :
58+ print ('ValueError' )
59+
60+ # bad property name
61+ try :
62+ my_print (json .loads ('{{}:"abc"}' ))
63+ except ValueError :
64+ print ('ValueError' )
65+
66+ # unexpected characters after white space
67+ try :
68+ my_print (json .loads ('[null] a' ))
69+ except ValueError :
70+ print ('ValueError' )
You can’t perform that action at this time.
0 commit comments