def test_deprecation(self): with pytest.warns(DeprecationWarning, match='deprecated'): Meta()
def test_deserialize_incorrect_type(self): field = Meta() value = 1 with pytest.raises(ValidationError) as excinfo: field.deserialize(value) assert excinfo.value.args[0] == 'Not a valid mapping type.'
def test_serialize_incorrect_type(self): field = Meta() with pytest.raises(ValidationError) as excinfo: field.serialize('meta', {'meta': 1}) assert excinfo.value.args[0] == 'Not a valid mapping type.'
def test_deserialize(self): field = Meta() value = {'page': {'offset': 1}} result = field.deserialize(value) assert result == value
def test_serialize(self): field = Meta() result = field.serialize('meta', {'meta': {'page': {'offset': 1}}}) assert result == {'page': {'offset': 1}}