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

Method test_unbind_threadlocal

tests/test_threadlocal.py:380–401  ·  view source on GitHub ↗

Test that unbinding from threadlocal works for keys that exist and does not raise error when they do not exist.

(self)

Source from the content-addressed store, hash-verified

378 )
379
380 def test_unbind_threadlocal(self):
381 """
382 Test that unbinding from threadlocal works for keys that exist
383 and does not raise error when they do not exist.
384 """
385 with pytest.deprecated_call():
386 bind_threadlocal(a=234, b=34)
387
388 with pytest.deprecated_call():
389 assert {"a": 234, "b": 34} == get_threadlocal()
390
391 with pytest.deprecated_call():
392 unbind_threadlocal("a")
393
394 with pytest.deprecated_call():
395 assert {"b": 34} == get_threadlocal()
396
397 with pytest.deprecated_call():
398 unbind_threadlocal("non-existing-key")
399
400 with pytest.deprecated_call():
401 assert {"b": 34} == get_threadlocal()
402
403 def test_get_context_no_context(self):
404 """

Callers

nothing calls this directly

Calls 3

bind_threadlocalFunction · 0.90
get_threadlocalFunction · 0.90
unbind_threadlocalFunction · 0.90

Tested by

no test coverage detected