MCPcopy
hub / github.com/marshmallow-code/marshmallow / _serialize

Method _serialize

tests/test_context.py:33–36  ·  view source on GitHub ↗
(self, value, attr, obj, **kwargs)

Source from the content-addressed store, hash-verified

31 def test_context_load_dump(self):
32 class ContextField(fields.Integer):
33 def _serialize(self, value, attr, obj, **kwargs):
34 if (context := Context[dict].get(None)) is not None:
35 value *= context.get("factor", 1)
36 return super()._serialize(value, attr, obj, **kwargs)
37
38 def _deserialize(self, value, attr, data, **kwargs):
39 val = super()._deserialize(value, attr, data, **kwargs)

Callers

nothing calls this directly

Calls 1

getMethod · 0.80

Tested by

no test coverage detected