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

Method test_pickle

tests/test_generic.py:43–53  ·  view source on GitHub ↗

Can be pickled and unpickled.

(self, proto)

Source from the content-addressed store, hash-verified

41 @pytest.mark.parametrize("proto", range(3, pickle.HIGHEST_PROTOCOL + 1))
42 @time_machine.travel("2023-05-22 17:00", tick=False)
43 def test_pickle(self, proto):
44 """
45 Can be pickled and unpickled.
46 """
47 b = BoundLogger(
48 ReturnLogger(),
49 _CONFIG.default_processors,
50 _CONFIG.default_context_class(),
51 ).bind(x=1)
52
53 assert b.info("hi") == pickle.loads(pickle.dumps(b, proto)).info("hi")
54
55 def test_deepcopy(self):
56 """

Callers

nothing calls this directly

Calls 4

BoundLoggerClass · 0.90
ReturnLoggerClass · 0.90
bindMethod · 0.45
infoMethod · 0.45

Tested by

no test coverage detected