Home / Function/ test_from_prefixed_env_nested() — flask Function Reference

test_from_prefixed_env_nested() — flask Function Reference

Architecture documentation for the test_from_prefixed_env_nested() function in test_config.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  ba7f5c40_f489_ad5f_d525_d267619443c3["test_from_prefixed_env_nested()"]
  af09ffc0_0dff_d9d9_7274_4611c3d0d0e6["test_config.py"]
  ba7f5c40_f489_ad5f_d525_d267619443c3 -->|defined in| af09ffc0_0dff_d9d9_7274_4611c3d0d0e6
  style ba7f5c40_f489_ad5f_d525_d267619443c3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_config.py lines 79–107

def test_from_prefixed_env_nested(monkeypatch):
    monkeypatch.setenv("FLASK_EXIST__ok", "other")
    monkeypatch.setenv("FLASK_EXIST__inner__ik", "2")
    monkeypatch.setenv("FLASK_EXIST__new__more", '{"k": false}')
    monkeypatch.setenv("FLASK_NEW__K", "v")

    app = flask.Flask(__name__)
    app.config["EXIST"] = {"ok": "value", "flag": True, "inner": {"ik": 1}}
    app.config.from_prefixed_env()

    if os.name != "nt":
        assert app.config["EXIST"] == {
            "ok": "other",
            "flag": True,
            "inner": {"ik": 2},
            "new": {"more": {"k": False}},
        }
    else:
        # Windows env var keys are always uppercase.
        assert app.config["EXIST"] == {
            "ok": "value",
            "OK": "other",
            "flag": True,
            "inner": {"ik": 1},
            "INNER": {"IK": 2},
            "NEW": {"MORE": {"k": False}},
        }

    assert app.config["NEW"] == {"K": "v"}

Subdomains

Frequently Asked Questions

What does test_from_prefixed_env_nested() do?
test_from_prefixed_env_nested() is a function in the flask codebase, defined in tests/test_config.py.
Where is test_from_prefixed_env_nested() defined?
test_from_prefixed_env_nested() is defined in tests/test_config.py at line 79.

Analyze Your Own Codebase

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

Try Supermodel Free