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

Method test_bind

tests/test_threadlocal.py:78–89  ·  view source on GitHub ↗

tmp_bind does not modify the thread-local state.

(self, log)

Source from the content-addressed store, hash-verified

76
77class TestTmpBind:
78 def test_bind(self, log):
79 """
80 tmp_bind does not modify the thread-local state.
81 """
82 log = log.bind(y=23)
83 with pytest.deprecated_call(), tmp_bind(log, x=42, y="foo") as tmp_log:
84 assert (
85 {"y": "foo", "x": 42}
86 == tmp_log._context._dict
87 == log._context._dict
88 )
89 assert {"y": 23} == log._context._dict
90
91 def test_bind_exc(self, log):
92 """

Callers

nothing calls this directly

Calls 2

tmp_bindFunction · 0.90
bindMethod · 0.45

Tested by

no test coverage detected