MCPcopy Create free account
hub / github.com/hynek/structlog / test_does_not_affect_global

Method test_does_not_affect_global

tests/test_threadlocal.py:130–143  ·  view source on GitHub ↗

A logger from as_mutable is independent from thread local state.

(self, log)

Source from the content-addressed store, hash-verified

128
129class TestAsImmutable:
130 def test_does_not_affect_global(self, log):
131 """
132 A logger from as_mutable is independent from thread local state.
133 """
134 log = log.new(x=42)
135 with pytest.deprecated_call():
136 il = as_immutable(log)
137
138 assert isinstance(il._context, dict)
139
140 il = il.bind(y=23)
141
142 assert {"x": 42, "y": 23} == il._context
143 assert {"x": 42} == log._context._dict
144
145 def test_converts_proxy(self, log):
146 """

Callers

nothing calls this directly

Calls 3

as_immutableFunction · 0.90
newMethod · 0.45
bindMethod · 0.45

Tested by

no test coverage detected