Example #1
0
def test_parse_successes():
    for path in jsondir.visit(lambda p: p.fnmatch('pass*.jtest')):
        with io.open(path.strpath) as infile:
            data = infile.read()
        # can't do much else because of float equality
        assert (json.dumps(parse(data), sort_keys=True)
                == json.dumps(json.loads(data), sort_keys=True))
Example #2
0
def jloads(s):
    return jsonmini.parse(s)
Example #3
0
def test_parse_failures():
    for path in jsondir.visit(lambda p: p.fnmatch('fail*.jtest')):
        with io.open(path.strpath) as infile:
            data = infile.read()
        with pytest.raises(ParseError):
            parse(data)
Example #4
0
def test_percent():
    assert parse('%') == None
Example #5
0
def test_bare_embedded_percent():
    assert parse('spam: %, eggs: {eggs: %}') == {'spam': None, 'eggs': {'eggs': None}}
Example #6
0
def test_bare_non_ascii_object():
    assert parse('\xff: eggs') == {'\xff': 'eggs'}
Example #7
0
def test_bare_object():
    assert parse('spam: eggs') == {'spam': 'eggs'}
Example #8
0
def test_bare_non_ascii():
    assert parse('\xff') == '\xff'
Example #9
0
def test_bare_string():
    assert parse('foo') == 'foo'
Example #10
0
def jloads(s):
    return jsonmini.parse(s)