Home / File/ test_templating.py — flask Source File

test_templating.py — flask Source File

Architecture documentation for test_templating.py, a python file in the flask codebase. 7 imports, 0 dependents.

File python ApplicationCore AppLifeCycle 7 imports 32 functions 4 classes

Entity Profile

Dependency Diagram

graph LR
  b3595fee_7041_96b0_f59f_4080381c7deb["test_templating.py"]
  9519a04a_d57b_a8a9_24e1_5d65cbdb5708["logging"]
  b3595fee_7041_96b0_f59f_4080381c7deb --> 9519a04a_d57b_a8a9_24e1_5d65cbdb5708
  da94d511_b8b8_a450_f67f_fc28ea9b648a["pytest"]
  b3595fee_7041_96b0_f59f_4080381c7deb --> da94d511_b8b8_a450_f67f_fc28ea9b648a
  ff917c05_6a39_6aa2_fc98_d3c5af4516f4["werkzeug.serving"]
  b3595fee_7041_96b0_f59f_4080381c7deb --> ff917c05_6a39_6aa2_fc98_d3c5af4516f4
  080c4713_770c_bdc4_fb40_89df334e08bb["jinja2"]
  b3595fee_7041_96b0_f59f_4080381c7deb --> 080c4713_770c_bdc4_fb40_89df334e08bb
  73ef7241_8c5f_09fd_18d9_bc9f2aafacb1["markupsafe"]
  b3595fee_7041_96b0_f59f_4080381c7deb --> 73ef7241_8c5f_09fd_18d9_bc9f2aafacb1
  8c762fc5_c0b6_0d4d_3889_896d80fbf225["flask"]
  b3595fee_7041_96b0_f59f_4080381c7deb --> 8c762fc5_c0b6_0d4d_3889_896d80fbf225
  ef82000a_b54a_2c25_300b_9ad828c1d961["blueprintapp"]
  b3595fee_7041_96b0_f59f_4080381c7deb --> ef82000a_b54a_2c25_300b_9ad828c1d961
  style b3595fee_7041_96b0_f59f_4080381c7deb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import logging

import pytest
import werkzeug.serving
from jinja2 import TemplateNotFound
from markupsafe import Markup

import flask


def test_context_processing(app, client):
    @app.context_processor
    def context_processor():
        return {"injected_value": 42}

    @app.route("/")
    def index():
        return flask.render_template("context_template.html", value=23)

    rv = client.get("/")
    assert rv.data == b"<p>23|42"


def test_original_win(app, client):
    @app.route("/")
    def index():
        return flask.render_template_string("{{ config }}", config=42)

    rv = client.get("/")
    assert rv.data == b"42"


def test_simple_stream(app, client):
    @app.route("/")
    def index():
        return flask.stream_template_string("{{ config }}", config=42)

    rv = client.get("/")
    assert rv.data == b"42"


def test_request_less_rendering(app, app_ctx):
    app.config["WORLD_NAME"] = "Special World"

    @app.context_processor
    def context_processor():
        return dict(foo=42)

    rv = flask.render_template_string("Hello {{ config.WORLD_NAME }} {{ foo }}")
    assert rv == "Hello Special World 42"


def test_standard_context(app, client):
    @app.route("/")
    def index():
        flask.g.foo = 23
        flask.session["test"] = "aha"
        return flask.render_template_string(
            """
            {{ request.args.foo }}
// ... (473 more lines)

Subdomains

Dependencies

  • blueprintapp
  • flask
  • jinja2
  • logging
  • markupsafe
  • pytest
  • werkzeug.serving

Frequently Asked Questions

What does test_templating.py do?
test_templating.py is a source file in the flask codebase, written in python. It belongs to the ApplicationCore domain, AppLifeCycle subdomain.
What functions are defined in test_templating.py?
test_templating.py defines 32 function(s): test_add_template_filter, test_add_template_filter_with_name, test_add_template_filter_with_name_and_template, test_add_template_filter_with_template, test_add_template_global, test_add_template_test, test_add_template_test_with_name, test_add_template_test_with_name_and_template, test_add_template_test_with_template, test_context_processing, and 22 more.
What does test_templating.py depend on?
test_templating.py imports 7 module(s): blueprintapp, flask, jinja2, logging, markupsafe, pytest, werkzeug.serving.
Where is test_templating.py in the architecture?
test_templating.py is located at tests/test_templating.py (domain: ApplicationCore, subdomain: AppLifeCycle, directory: tests).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free