Example #1
0
def test_loads():
    with open(TEST_FILE) as fp:
        string = fp.read()

    loaded = loads(string)

    assert loaded == expected
Example #2
0
    def wrapper(*args, **kwargs):
        string, expect = f(*args, **kwargs)

        assert loads(string) == expect
Example #3
0
def test_string_escaped():
    assert (loads('escaped = "this ""string"" is ""escaped"".";') == {
        'escaped': 'this "string" is "escaped".'
    })
Example #4
0
def test_array_oned():
    assert loads('oned[] = {1, two, 3, "4", 5 six seven};') == {
        'oned': [1, 'two', 3, 4, '5 six seven']
    }
Example #5
0
def test_string_unquoted():
    assert loads('unquoted = unquoted string;') == {
        'unquoted': 'unquoted string'
    }
Example #6
0
def test_string_joined():
    assert (
        loads('joined = unquoted and "quoted" strings "joined" together;') == {
            'joined': 'unquoted and quoted strings joined together'
        })
Example #7
0
def test_array_symbol():
    with pytest.raises(Unexpected):
        loads('array[] = 1;')

    assert loads('string = {"array"};') == {'string': '{array}'}
Example #8
0
def test_string_quoted():
    assert loads('quoted = "quoted string";') == {'quoted': 'quoted string'}
Example #9
0
def test_array_multi():
    assert loads('multi[] = {1, {2, 3}, {{4, 5, 6 seven, {}}}};') == {
        'multi': [1, [2, 3], [[4, 5, "6 seven", []]]]
    }
Example #10
0
def test_missing_eq():
    with pytest.raises(UnexpectedValue):
        loads('prop } "3";')
Example #11
0
def test_array_opener():
    with pytest.raises(UnexpectedValue):
        loads('array[] = [2, 1};')
Example #12
0
def test_class_closer():
    with pytest.raises(UnexpectedType):
        loads('class test {property = 3;];')
Example #13
0
def test_class_opener():
    with pytest.raises(UnexpectedValue):
        loads('class test [property = 3;};')