test_app_ctx_globals_methods() — flask Function Reference
Architecture documentation for the test_app_ctx_globals_methods() function in test_appctx.py from the flask codebase.
Entity Profile
Dependency Diagram
graph TD 97b596de_3509_b218_bf97_12556fc9f44c["test_app_ctx_globals_methods()"] 64d09782_9311_5dea_7886_5faca96ebc84["test_appctx.py"] 97b596de_3509_b218_bf97_12556fc9f44c -->|defined in| 64d09782_9311_5dea_7886_5faca96ebc84 style 97b596de_3509_b218_bf97_12556fc9f44c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/test_appctx.py lines 136–156
def test_app_ctx_globals_methods(app, app_ctx):
# get
assert flask.g.get("foo") is None
assert flask.g.get("foo", "bar") == "bar"
# __contains__
assert "foo" not in flask.g
flask.g.foo = "bar"
assert "foo" in flask.g
# setdefault
flask.g.setdefault("bar", "the cake is a lie")
flask.g.setdefault("bar", "hello world")
assert flask.g.bar == "the cake is a lie"
# pop
assert flask.g.pop("bar") == "the cake is a lie"
with pytest.raises(KeyError):
flask.g.pop("bar")
assert flask.g.pop("bar", "more cake") == "more cake"
# __iter__
assert list(flask.g) == ["foo"]
# __repr__
assert repr(flask.g) == "<flask.g of 'flask_test'>"
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does test_app_ctx_globals_methods() do?
test_app_ctx_globals_methods() is a function in the flask codebase, defined in tests/test_appctx.py.
Where is test_app_ctx_globals_methods() defined?
test_app_ctx_globals_methods() is defined in tests/test_appctx.py at line 136.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free