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


Python flask.get_template_attribute方法代码示例

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


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

示例1: test_modal_causative

# 需要导入模块: import flask [as 别名]
# 或者: from flask import get_template_attribute [as 别名]
def test_modal_causative(app, case_obj, institute_obj, variant_obj):

    # GIVEN an initialized app
    with app.test_client() as client:

        # WHILE collection a specific jinja macro
        macro = get_template_attribute("variants/utils.html", "modal_causative")
        # and passing to it the required parameters
        # Including a case without HPO phenotype or diagnosis (OMIM terms) assigned
        html = macro(case_obj, institute_obj, variant_obj)

        # THEN the macro should contain the expected warning message
        assert "Assign at least an OMIM diagnosis or a HPO phenotype term" in html

        # WHEN the case contains one or more phenotype terms:
        case_obj["phenotype_terms"] = {
            "phenotype_id": "HPO:0002637",
            "feature": "Cerebral ischemia",
        }
        # and/or OMIM diagnoses
        case_obj["diagnosis_phenotypes"] = [616833]

        # THEN the macro should allow to assign partial causatives
        html = macro(case_obj, institute_obj, variant_obj)
        assert "Assign at least an OMIM diagnosis or a HPO phenotype term" not in html 
开发者ID:Clinical-Genomics,项目名称:scout,代码行数:27,代码来源:test_variants_utils.py

示例2: test_macros

# 需要导入模块: import flask [as 别名]
# 或者: from flask import get_template_attribute [as 别名]
def test_macros(self):
        app = flask.Flask(__name__)
        with app.test_request_context():
            macro = flask.get_template_attribute('_macro.html', 'hello')
            self.assert_equal(macro('World'), 'Hello World!') 
开发者ID:chalasr,项目名称:Flask-P2P,代码行数:7,代码来源:templating.py

示例3: test_modal_prompt_filter_name

# 需要导入模块: import flask [as 别名]
# 或者: from flask import get_template_attribute [as 别名]
def test_modal_prompt_filter_name(app):
    # GIVEN an initialized app
    with app.test_client() as client:
        # WHILE collection a specific jinja macro
        macro = get_template_attribute("variants/utils.html", "modal_prompt_filter_name")
        # and passing to it the required parameters
        # Including a case without HPO phenotype or diagnosis (OMIM terms) assigned
        form = FiltersForm()
        html = macro(form)
        # THEN a string from the modal can be found in the output
        assert "Please name" in html 
开发者ID:Clinical-Genomics,项目名称:scout,代码行数:13,代码来源:test_variants_utils.py

示例4: test_update_individuals_table

# 需要导入模块: import flask [as 别名]
# 或者: from flask import get_template_attribute [as 别名]
def test_update_individuals_table(app, case_obj, institute_obj):
    # GIVEN an initialized app
    with app.test_client() as client:

        # WHEN collecting the individuals_table jinja macro
        macro = get_template_attribute("cases/individuals_table.html", "individuals_table")

        # and passing to it the required parameters
        html = macro(case_obj, institute_obj, SAMPLE_SOURCE)

        # THEN the macro should contain the expected html code
        assert '<div class="panel-heading">Individuals</div>' in html 
开发者ID:Clinical-Genomics,项目名称:scout,代码行数:14,代码来源:test_cases_utils.py

示例5: query_result

# 需要导入模块: import flask [as 别名]
# 或者: from flask import get_template_attribute [as 别名]
def query_result():
    """Render a query result to HTML."""
    query = request.args.get("query_string", "")
    table = get_template_attribute("_query_table.html", "querytable")
    contents, types, rows = g.ledger.query_shell.execute_query(query)
    if contents:
        if "ERROR" in contents:
            raise FavaAPIException(contents)
    table = table(contents, types, rows)
    if types and g.ledger.charts.can_plot_query(types):
        return {
            "table": table,
            "chart": g.ledger.charts.query(types, rows),
        }
    return {"table": table} 
开发者ID:beancount,项目名称:fava,代码行数:17,代码来源:json_api.py


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