示例#1
0
def test_parse_switch():
    t = parse(u"{{#switch: A | a=lower | UPPER}}")
    print t
    assert isinstance(t, nodes.SwitchNode)

    t = parse(u"{{#switch: A | a=lower | UPPER}}", siteinfo=nl_siteinfo)
    print t
    assert isinstance(t, nodes.SwitchNode)
示例#2
0
def test_parse_if():
    t = parse(u"{{#if: 1 | yes | no}}")
    print t
    assert isinstance(t, nodes.IfNode)

    t = parse(u"{{#if: 1 | yes | no}}", siteinfo=nl_siteinfo)
    print t
    assert isinstance(t, nodes.IfNode)
示例#3
0
def parse_and_show(s):
    res = expander.parse(s)
    print "PARSE:", repr(s)
    expander.show(res)
    return res
示例#4
0
def test_no_arguments():
    t = parse(u"{{bla}}")
    assert t[1] == (), "expected an empty tuple"
示例#5
0
def test_parse_time_localized():
    t = parse(u"{{#tijd:Y-m-d|2006-09-28}}", siteinfo=nl_siteinfo)
    print t
    assert isinstance(t, magic_nodes.Time)
示例#6
0
def test_parse_time():
    t = parse(u"{{#time:Y-m-d|2006-09-28}}")
    print t
    assert isinstance(t, magic_nodes.Time)
示例#7
0
def test_parse_switch_localized():
    t = parse(u"{{#schakelen: A | a=lower | UPPER}}", siteinfo=nl_siteinfo)
    print t
    assert isinstance(t, nodes.SwitchNode)
示例#8
0
def test_parse_if_localized():
    t = parse(u"{{#als: 1 | yes | no}}", siteinfo=nl_siteinfo)
    print t
    assert isinstance(t, nodes.IfNode)
示例#9
0
def test_one_empty_arguments():
    t = parse(u"{{bla|}}")
    assert len(t[1]) == 1, "expected exactly one argument"