Exemplo n.º 1
0
def test_nested_else():
    with pytest.raises(ParseError):
        pyxl_decode(b"""
            <frag>
                <if cond="{true}">foo</if>
                <else><else>bar</else></else>
            </frag>""")
Exemplo n.º 2
0
def test_malformed_if():
    with pytest.raises(ParseError):
        pyxl_decode(b"""
            <frag>
                <if cond="{true}">foo</if>
                this is incorrect!
                <else>bar</else>
            </frag>""")
Exemplo n.º 3
0
def _expect_failure(file_name):
    path = os.path.join(error_cases_path, file_name)
    try:
        with open(path) as f:
            print pyxl_decode(f.read())
        assert False, "successfully decoded file %r" % file_name
    except (PyxlParseError, ParseError):
        pass
Exemplo n.º 4
0
def test_bad_char2():
    with pytest.raises(BadCharError):
        pyxl_decode(b'<div class="foo"=></div>')
Exemplo n.º 5
0
def test_bad_char1():
    with pytest.raises(BadCharError):
        pyxl_decode(b'<_bad_element></lm>')