本文整理汇总了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
示例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!')
示例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
示例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
示例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}