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

Method test_clear

tests/test_threadlocal.py:344–356  ·  view source on GitHub ↗

The thread-local context can be cleared, causing any previously bound variables to not be included in merge_threadlocal's result.

(self)

Source from the content-addressed store, hash-verified

342 assert {"a": 1, "b": 2} == merge_threadlocal(None, None, {"b": 2})
343
344 def test_clear(self):
345 """
346 The thread-local context can be cleared, causing any previously bound
347 variables to not be included in merge_threadlocal's result.
348 """
349 with pytest.deprecated_call():
350 bind_threadlocal(a=1)
351
352 with pytest.deprecated_call():
353 clear_threadlocal()
354
355 with pytest.deprecated_call():
356 assert {"b": 2} == merge_threadlocal(None, None, {"b": 2})
357
358 def test_merge_works_without_bind(self):
359 """

Callers

nothing calls this directly

Calls 3

bind_threadlocalFunction · 0.90
clear_threadlocalFunction · 0.90
merge_threadlocalFunction · 0.90

Tested by

no test coverage detected