当前位置: 首页>>代码示例>>Python>>正文


Python General.gen_q_html方法代码示例

本文整理汇总了Python中oasis.lib.General.gen_q_html方法的典型用法代码示例。如果您正苦于以下问题:Python General.gen_q_html方法的具体用法?Python General.gen_q_html怎么用?Python General.gen_q_html使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在oasis.lib.General的用法示例。


在下文中一共展示了General.gen_q_html方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_instance_generate_multif_answer

# 需要导入模块: from oasis.lib import General [as 别名]
# 或者: from oasis.lib.General import gen_q_html [as 别名]
def test_instance_generate_multif_answer():
    """ Convert some html templates + variables into resulting instance HTML
        and make sure it's doing it right. Focus on multif choice "ANSWER"

        No side effects.
    """

    tmpl = "blah<ANSWER1 MULTIF f,g,h,i>blah"
    qvars = {'f': 7, 'g': "joe", "h": "3.4", "i": 33}
    html = """blah<table border=0><tr><td>Please choose one:</td><td CLASS='multichoicecell'><INPUT class='auto_save' TYPE='radio' NAME='ANS_1' VALUE='1' Oa_CHK_1_1>7</td><td CLASS='multichoicecell'><INPUT class='auto_save' TYPE='radio' NAME='ANS_1' VALUE='2' Oa_CHK_1_2>joe</td><td CLASS='multichoicecell'><INPUT class='auto_save' TYPE='radio' NAME='ANS_1' VALUE='3' Oa_CHK_1_3>3.4</td><td CLASS='multichoicecell'><INPUT class='auto_save' TYPE='radio' NAME='ANS_1' VALUE='4' Oa_CHK_1_4>33</td></tr></table><br />
blah"""
    res = General.gen_q_html(qvars, tmpl)
    assert res == html

    tmpl = "blah<ANSWER1 MULTIF f,g,h,i,j>blah"
    qvars = {'f': 7, 'g': "joe", "h": "3.4", "i": 33, "j": "&amp;"}
    html = """blah<table border=0><tr><td>Please choose one:</td><td CLASS='multichoicecell'><INPUT class='auto_save' TYPE='radio' NAME='ANS_1' VALUE='1' Oa_CHK_1_1>7</td><td CLASS='multichoicecell'><INPUT class='auto_save' TYPE='radio' NAME='ANS_1' VALUE='2' Oa_CHK_1_2>joe</td><td CLASS='multichoicecell'><INPUT class='auto_save' TYPE='radio' NAME='ANS_1' VALUE='3' Oa_CHK_1_3>3.4</td><td CLASS='multichoicecell'><INPUT class='auto_save' TYPE='radio' NAME='ANS_1' VALUE='4' Oa_CHK_1_4>33</td><td CLASS='multichoicecell'><INPUT class='auto_save' TYPE='radio' NAME='ANS_1' VALUE='5' Oa_CHK_1_5>&amp;</td></tr></table><br />
blah"""
    res = General.gen_q_html(qvars, tmpl)
    assert res == html

    tmpl = "blah<ANSWER1 MULTIF f,g,h,"
    qvars = {'f': 7, 'g': "joe", "h": "3.4", "i": 33, "j": "&amp;"}
    html = """blah<ANSWER1 MULTIF f,g,h,"""
    res = General.gen_q_html(qvars, tmpl)
    assert res == html

    tmpl = "blah<ANSWER1 MULTIF f,g,h,i,j>"
    qvars = {'f': 7, 'g': "joe"}
    html = """blah<table border=0><tr><td>Please choose one:</td><td CLASS='multichoicecell'><INPUT class='auto_save' TYPE='radio' NAME='ANS_1' VALUE='1' Oa_CHK_1_1>7</td><td CLASS='multichoicecell'><INPUT class='auto_save' TYPE='radio' NAME='ANS_1' VALUE='2' Oa_CHK_1_2>joe</td><FONT COLOR="red">ERROR IN QUESTION DATA</FONT><FONT COLOR="red">ERROR IN QUESTION DATA</FONT><FONT COLOR="red">ERROR IN QUESTION DATA</FONT></tr></table><br />\n"""
    res = General.gen_q_html(qvars, tmpl)
    assert res == html
开发者ID:tkanesh,项目名称:oasisqe,代码行数:34,代码来源:test_qengine.py

示例2: test_instance_generate_simple_answer

# 需要导入模块: from oasis.lib import General [as 别名]
# 或者: from oasis.lib.General import gen_q_html [as 别名]
def test_instance_generate_simple_answer():
    """ Convert some html templates + variables into resulting instance HTML
        and make sure it's doing it right. Focus on simple "ANSWER"

        No side effects.
    """

    tmpl = "blah<ANSWER1>blah"
    qvars = {}
    html = """blah<INPUT class='auto_save' TYPE='text' NAME='ANS_1' VALUE="VAL_1"/>blah"""
    res = General.gen_q_html(qvars, tmpl)
    assert res == html

    tmpl = "blah<ANSWER2>blah"
    qvars = {}
    html = """blah<INPUT class='auto_save' TYPE='text' NAME='ANS_2' VALUE="VAL_2"/>blah"""
    res = General.gen_q_html(qvars, tmpl)
    assert res == html

    tmpl = "foo<ANSWER1>blah<ANSWER2>blah"
    qvars = {}
    html = """foo<INPUT class='auto_save' TYPE='text' NAME='ANS_1' VALUE="VAL_1"/>blah<INPUT class='auto_save' TYPE='text' NAME='ANS_2' VALUE="VAL_2"/>blah"""
    res = General.gen_q_html(qvars, tmpl)
    assert res == html
开发者ID:tkanesh,项目名称:oasisqe,代码行数:26,代码来源:test_qengine.py

示例3: test_instance_generate_variable

# 需要导入模块: from oasis.lib import General [as 别名]
# 或者: from oasis.lib.General import gen_q_html [as 别名]
def test_instance_generate_variable():
    """ Convert some html templates + variables into resulting instance HTML
        and make sure it's doing it right. Focus on variable subs.

        No side effects.
    """

    tmpl = "The value is <VAL A>"
    qvars = {"A": 7, "a": 5, "Arthur": 3}
    html = """The value is 7"""
    res = General.gen_q_html(qvars, tmpl)
    assert res == html

    tmpl = "The value is <VAL A> <VAL Arthur>"
    qvars = {"A": 7, "a": 5, "Arthur": 3}
    html = """The value is 7 3"""
    res = General.gen_q_html(qvars, tmpl)
    assert res == html

    tmpl = "The value is <VAL A> <VAL Arthur>"
    qvars = {"A": "&amp;", "a": 5, "Arthur": 3}
    html = """The value is &amp; 3"""
    res = General.gen_q_html(qvars, tmpl)
    assert res == html

    tmpl = "The value is <VAL A> <VAL Arthur>"
    qvars = {"A": "<blink>annoying</blink>", "a": 5, "Arthur": 3}
    html = """The value is <blink>annoying</blink> 3"""
    res = General.gen_q_html(qvars, tmpl)
    assert res == html

    tmpl = "The value is <VAL A> <VAL Arthur>"
    qvars = {"A": u"\x9f", "a": 5, "Arthur": 3}
    html = u"""The value is \x9f 3"""
    res = General.gen_q_html(qvars, tmpl)
    assert res == html
开发者ID:tkanesh,项目名称:oasisqe,代码行数:38,代码来源:test_qengine.py


注:本文中的oasis.lib.General.gen_q_html方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。