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

Method test_nesting_works

tests/test_threadlocal.py:469–482  ·  view source on GitHub ↗

bound_threadlocal binds and unbinds even when nested

(self)

Source from the content-addressed store, hash-verified

467 assert {"y": "foo"} == get_threadlocal()
468
469 def test_nesting_works(self):
470 """
471 bound_threadlocal binds and unbinds even when nested
472 """
473 with pytest.deprecated_call():
474 with bound_threadlocal(l1=1):
475 assert {"l1": 1} == get_threadlocal()
476
477 with bound_threadlocal(l2=2):
478 assert {"l1": 1, "l2": 2} == get_threadlocal()
479
480 assert {"l1": 1} == get_threadlocal()
481
482 assert {} == get_threadlocal()
483
484 def test_as_decorator(self):
485 """

Callers

nothing calls this directly

Calls 2

bound_threadlocalFunction · 0.90
get_threadlocalFunction · 0.90

Tested by

no test coverage detected