test_context_processing() — flask Function Reference
Architecture documentation for the test_context_processing() function in test_blueprints.py from the flask codebase.
Entity Profile
Dependency Diagram
graph TD 6408bdf7_49fd_4391_3434_19a0dbe5dbfb["test_context_processing()"] 4366a441_d387_52f9_ec8d_1c41c71c00a8["test_blueprints.py"] 6408bdf7_49fd_4391_3434_19a0dbe5dbfb -->|defined in| 4366a441_d387_52f9_ec8d_1c41c71c00a8 style 6408bdf7_49fd_4391_3434_19a0dbe5dbfb fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/test_blueprints.py lines 682–720
def test_context_processing(app, client):
answer_bp = flask.Blueprint("answer_bp", __name__)
def template_string():
return flask.render_template_string(
"{% if notanswer %}{{ notanswer }} is not the answer. {% endif %}"
"{% if answer %}{{ answer }} is the answer.{% endif %}"
)
# App global context processor
@answer_bp.app_context_processor
def not_answer_context_processor():
return {"notanswer": 43}
# Blueprint local context processor
@answer_bp.context_processor
def answer_context_processor():
return {"answer": 42}
# Setup endpoints for testing
@answer_bp.route("/bp")
def bp_page():
return template_string()
@app.route("/")
def app_page():
return template_string()
# Register the blueprint
app.register_blueprint(answer_bp)
app_page_bytes = client.get("/").data
answer_page_bytes = client.get("/bp").data
assert b"43" in app_page_bytes
assert b"42" not in app_page_bytes
assert b"42" in answer_page_bytes
assert b"43" in answer_page_bytes
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does test_context_processing() do?
test_context_processing() is a function in the flask codebase, defined in tests/test_blueprints.py.
Where is test_context_processing() defined?
test_context_processing() is defined in tests/test_blueprints.py at line 682.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free