def test_serialize(self): field = DocumentMeta() result = field.serialize('document_meta', {'document_meta': { 'page': { 'offset': 1 } }}) assert result == {'page': {'offset': 1}}
def test_serialize(self): field = DocumentMeta() result = field.serialize("document_meta", {"document_meta": { "page": { "offset": 1 } }}) assert result == {"page": {"offset": 1}}
def test_serialize_incorrect_type(self): field = DocumentMeta() with pytest.raises(ValidationError) as excinfo: field.serialize('document_meta', {'document_meta': 1}) assert excinfo.value.args[0] == 'Not a valid mapping type.'