Beispiel #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))
Beispiel #2
0
def jloads(s):
    return jsonmini.parse(s)
Beispiel #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)
Beispiel #4
0
def test_percent():
    assert parse('%') == None
Beispiel #5
0
def test_bare_embedded_percent():
    assert parse('spam: %, eggs: {eggs: %}') == {'spam': None, 'eggs': {'eggs': None}}
Beispiel #6
0
def test_bare_non_ascii_object():
    assert parse('\xff: eggs') == {'\xff': 'eggs'}
Beispiel #7
0
def test_bare_object():
    assert parse('spam: eggs') == {'spam': 'eggs'}
Beispiel #8
0
def test_bare_non_ascii():
    assert parse('\xff') == '\xff'
Beispiel #9
0
def test_bare_string():
    assert parse('foo') == 'foo'
Beispiel #10
0
def jloads(s):
    return jsonmini.parse(s)