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

Method test_tmp_bind_lazy

tests/test_threadlocal.py:111–126  ·  view source on GitHub ↗

tmp_bind works with a BoundLoggerLazyProxy -- i.e. before the first bind.

(self)

Source from the content-addressed store, hash-verified

109 assert {"y": 23} == log._context._dict
110
111 def test_tmp_bind_lazy(self):
112 """
113 tmp_bind works with a BoundLoggerLazyProxy -- i.e. before the first
114 bind.
115 """
116 with pytest.deprecated_call():
117 structlog.configure(context_class=wrap_dict(dict))
118
119 log = get_logger()
120
121 assert isinstance(log, BoundLoggerLazyProxy)
122
123 with pytest.deprecated_call(), tmp_bind(log, x=42) as tmp_log:
124 assert {"x": 42} == tmp_log._context._dict
125
126 assert {} == log._context
127
128
129class TestAsImmutable:

Callers

nothing calls this directly

Calls 3

wrap_dictFunction · 0.90
get_loggerFunction · 0.90
tmp_bindFunction · 0.90

Tested by

no test coverage detected