classification
Title: json module apparently fails regression found at http://json.org/JSON_checker/test.zip.
Type: behavior Stage:
Components: Extension Modules Versions: Python 2.6
process
Status: closed Resolution: invalid
Dependencies: Superseder:
Assigned To: bob.ippolito Nosy List: DougShawhan, bob.ippolito (2)
Priority: Keywords

Created on 2009-11-06 18:11 by DougShawhan, last changed 2009-11-09 02:53 by DougShawhan.

Files
File name Uploaded Description Edit Remove
unnamed DougShawhan, 2009-11-09 02:53
Messages (3)
msg94990 - (view) Author: Douglas Shawhan (DougShawhan) Date: 2009-11-06 18:11
Environment:
Ubuntu 9.04 Jaunty
Linux thebadpipsissewah 2.6.28-16-server #55-Ubuntu SMP Tue Oct 20
20:37:10 UTC 2009 x86_64 GNU/Linux
Python 2.6.2 (release26-maint, Apr 19 2009, 01:58:18) 
[GCC 4.3.3] on linux2

Passes two "fail" cases:
fail1.json "A JSON payload should be an object or array, not a string."
fail18.json [[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]

All other cases pass or fail as indicated.

=== test ===

#!/usr/bin/env python

import json, os
from StringIO import StringIO

def Validate( case ):
    try:
        l = json.loads( case[1] )
        print( "%s %s"%case )
    except:
        pass

    try:
        io = StringIO( case[1] )
        json.load( io )
        print( "%s %s"%case )
    except:
        pass

for passfail in [ "fail" ]:
    cases = [ [( i, open( os.path.join( base, i ), "r").read() )
                for i in files if passfail in i ]
                for base, subs, files in os.walk( "tests" ) ][0]

    [ Validate( case ) for case in cases ]

Sorry for ugly code, in a hurry. If this is wrong, please feel free to
backhand me.

d
msg95004 - (view) Author: Bob Ippolito (bob.ippolito) Date: 2009-11-06 22:45
The json module departs slightly from the spec in that it will allow you 
to consume and produce documents that don't have an array or object 
envelope. This is a feature.

The "Too deep" test case is just a silly thing that crockford's code 
does, there's a fixed limitation for how complex an object could be. 
That's not a regression failure and the spec doesn't say anything about 
a maximum nesting level.

The json module includes all of these in its test suite, although it 
disagrees slightly with crockford on what should pass.

http://svn.python.org/view/python/branches/release26-
maint/Lib/json/tests/test_fail.py

SKIPS = {
    1: "why not have a string payload?",
    18: "spec doesn't specify any nesting limitations",
}
msg95056 - (view) Author: Douglas Shawhan (DougShawhan) Date: 2009-11-09 02:53
Fair enough. Thanks.

On Fri, Nov 6, 2009 at 5:45 PM, Bob Ippolito <report@bugs.python.org> wrote:

>
> Bob Ippolito <bob@redivi.com> added the comment:
>
> The json module departs slightly from the spec in that it will allow you
> to consume and produce documents that don't have an array or object
> envelope. This is a feature.
>
> The "Too deep" test case is just a silly thing that crockford's code
> does, there's a fixed limitation for how complex an object could be.
> That's not a regression failure and the spec doesn't say anything about
> a maximum nesting level.
>
> The json module includes all of these in its test suite, although it
> disagrees slightly with crockford on what should pass.
>
> http://svn.python.org/view/python/branches/release26-
> maint/Lib/json/tests/test_fail.py<Lib/json/tests/test_fail.py">http://svn.python.org/view/python/branches/release26-%0Amaint/Lib/json/tests/test_fail.py>
>
> SKIPS = {
>    1: "why not have a string payload?",
>    18: "spec doesn't specify any nesting limitations",
> }
>
> ----------
> resolution:  -> invalid
> status: open -> closed
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue7274>
> _______________________________________
>
History
Date User Action Args
2009-11-09 02:53:18DougShawhansetfiles: + unnamed

messages: + msg95056
2009-11-06 22:45:09bob.ippolitosetstatus: open -> closed
resolution: invalid
messages: + msg95004
2009-11-06 21:40:13benjamin.petersonsetassignee: bob.ippolito

nosy: + bob.ippolito
2009-11-06 18:11:41DougShawhancreate