MCPcopy Create free account
hub / github.com/encode/starlette / test_environ

Function test_environ

tests/test_config.py:112–134  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

110
111
112def test_environ() -> None:
113 environ = Environ()
114
115 # We can mutate the environ at this point.
116 environ["TESTING"] = "True"
117 environ["GONE"] = "123"
118 del environ["GONE"]
119
120 # We can read the environ.
121 assert environ["TESTING"] == "True"
122 assert "GONE" not in environ
123
124 # We cannot mutate these keys now that we've read them.
125 with pytest.raises(EnvironError):
126 environ["TESTING"] = "False"
127
128 with pytest.raises(EnvironError):
129 del environ["GONE"]
130
131 # Test coverage of abstract methods for MutableMapping.
132 environ = Environ()
133 assert list(iter(environ)) == list(iter(os.environ))
134 assert len(environ) == len(os.environ)
135
136
137def test_config_with_env_prefix(tmpdir: Path, monkeypatch: pytest.MonkeyPatch) -> None:

Callers

nothing calls this directly

Calls 1

EnvironClass · 0.90

Tested by

no test coverage detected