Esempio n. 1
0
def test_else_with_prop():
    with pytest.raises(ParserError):
        pyxl_decode(b"""
            <Fragment>
                <if cond="{true}">foo</if>
                <else foo="bar">bar</else>
            </Fragment>""")
Esempio n. 2
0
def test_nested_else():
    with pytest.raises(ParserError):
        pyxl_decode(b"""
            <Fragment>
                <if cond="{true}">foo</if>
                <else><else>bar</else></else>
            </Fragment>""")
Esempio n. 3
0
def test_malformed_if():
    with pytest.raises(ParserError):
        pyxl_decode(b"""
            <Fragment>
                <if cond="{true}">foo</if>
                this is incorrect!
                <else>bar</else>
            </Fragment>""")
Esempio n. 4
0
def test_missing_if_cond():
    with pytest.raises(ParserError):
        pyxl_decode(b"""
            <Fragment>
                <if>foo</if>
            </Fragment>""")

    with pytest.raises(ParserError):
        pyxl_decode(b"""
            <Fragment>
                <if foo="bar">foo</if>
            </Fragment>""")
Esempio n. 5
0
def test_invalid_if_prop():
    with pytest.raises(ParserError):
        pyxl_decode(b"""
            <Fragment>
                <if cond="{true}" foo="bar">foo</if>
            </Fragment>""")
Esempio n. 6
0
def test_invalid_python():
    with pytest.raises(ParserError):
        pyxl_decode(b'<textarea {"foo"} />')