Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

global: remove PendingDeprecationWarning #140

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion invenio_rest/csrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
<https://github.com/django/django/blob/master/django/middleware/csrf.py>
"""

import re
import secrets
import string
from datetime import datetime, timedelta, timezone
Expand Down
26 changes: 0 additions & 26 deletions invenio_rest/serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

"""REST API serializers."""

import warnings

from marshmallow import Schema


Expand All @@ -20,18 +18,6 @@ def __init__(self, result):
"""Initialize MarshmalDict."""
self.update(result)

@property
def data(self):
"""Substituting data property for backwards compatibility."""
warnings.warn(
"Schema().dump().data and Schema().dump().errors "
"as well as Schema().load().data and Schema().loads().data"
"attributes are deprecated in marshmallow v3.x.",
category=PendingDeprecationWarning,
stacklevel=2,
)
return self


class MarshmalList(list):
"""Wrapping class for result of type list."""
Expand All @@ -40,18 +26,6 @@ def __init__(self, result):
"""Initialize MarshmalList."""
self.extend(result)

@property
def data(self):
"""Substituting data property for backwards compatibility."""
warnings.warn(
"Schema().dump().data and Schema().dump().errors "
"as well as Schema().load().data and Schema().loads().data"
"attributes are deprecated in marshmallow v3.x.",
category=PendingDeprecationWarning,
stacklevel=2,
)
return self


def result_wrapper(result):
"""Wrap schema returned dump value."""
Expand Down
5 changes: 1 addition & 4 deletions tests/test_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class TestSchema(BaseSchema):
title = fields.Str(attribute="title")

data = {"title": "test"}
assert (TestSchema().dump(data)).data == {"title": "test"}
assert (TestSchema().dump(data)) == {"title": "test"}


def test_marshmallow_compatibility():
Expand All @@ -37,13 +37,10 @@ def test_marshmallow_compatibility():
wrapped = result_wrapper(dict_result)

assert wrapped == dict_result
assert wrapped.data == dict_result

wrapped = result_wrapper(list_result)
assert wrapped == list_result
assert wrapped.data == list_result

wrapped = result_wrapper(tuple_result)
assert wrapped == tuple_result
assert isinstance(wrapped, tuple)
assert tuple_result.data == dict_result
Loading