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

Method test_caches

tests/test_generic.py:25–39  ·  view source on GitHub ↗

__getattr__() gets called only once per logger method.

(self)

Source from the content-addressed store, hash-verified

23
24class TestGenericBoundLogger:
25 def test_caches(self):
26 """
27 __getattr__() gets called only once per logger method.
28 """
29 b = BoundLogger(
30 ReturnLogger(),
31 _CONFIG.default_processors,
32 _CONFIG.default_context_class(),
33 )
34
35 assert "msg" not in b.__dict__
36
37 b.msg("foo")
38
39 assert "msg" in b.__dict__
40
41 @pytest.mark.parametrize("proto", range(3, pickle.HIGHEST_PROTOCOL + 1))
42 @time_machine.travel("2023-05-22 17:00", tick=False)

Callers

nothing calls this directly

Calls 3

msgMethod · 0.95
BoundLoggerClass · 0.90
ReturnLoggerClass · 0.90

Tested by

no test coverage detected