Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
e4e3f573
Commit
e4e3f573
authored
Apr 22, 2015
by
kazmiruk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix test for OrderedDict
parent
51650f88
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
tests/test_fields.py
+2
-2
tests/test_serializer.py
+3
-3
No files found.
tests/test_fields.py
View file @
e4e3f573
...
...
@@ -3,6 +3,7 @@ General serializer field tests.
"""
from
__future__
import
unicode_literals
from
collections
import
OrderedDict
import
datetime
import
re
from
decimal
import
Decimal
...
...
@@ -10,7 +11,6 @@ from uuid import uuid4
from
django.core
import
validators
from
django.db
import
models
from
django.test
import
TestCase
from
django.utils.datastructures
import
SortedDict
from
rest_framework
import
serializers
from
tests.models
import
RESTFrameworkModel
...
...
@@ -95,7 +95,7 @@ class BasicFieldTests(TestCase):
Field should preserve dictionary ordering, if it exists.
See: https://github.com/tomchristie/django-rest-framework/issues/832
"""
ret
=
Sort
edDict
()
ret
=
Order
edDict
()
ret
[
'c'
]
=
1
ret
[
'b'
]
=
1
ret
[
'a'
]
=
1
...
...
tests/test_serializer.py
View file @
e4e3f573
...
...
@@ -1297,7 +1297,7 @@ class SerializerPickleTests(TestCase):
def
test_pickle_inner_serializer
(
self
):
"""
Test pickling a serializer whose resulting .data (a
Sort
edDictWithMetadata) will
Test pickling a serializer whose resulting .data (a
Order
edDictWithMetadata) will
have unpickleable meta data--in order to make sure metadata doesn't get pulled into the pickle.
See DictWithMetadata.__getstate__
"""
...
...
@@ -1312,13 +1312,13 @@ class SerializerPickleTests(TestCase):
Regression test for #645.
"""
data
=
serializers
.
DictWithMetadata
({
1
:
1
})
self
.
assertEqual
(
data
.
__getstate__
(),
serializers
.
Sort
edDict
({
1
:
1
}))
self
.
assertEqual
(
data
.
__getstate__
(),
serializers
.
Order
edDict
({
1
:
1
}))
def
test_serializer_data_is_pickleable
(
self
):
"""
Another regression test for #645.
"""
data
=
serializers
.
Sort
edDictWithMetadata
({
1
:
1
})
data
=
serializers
.
Order
edDictWithMetadata
({
1
:
1
})
repr
(
pickle
.
loads
(
pickle
.
dumps
(
data
,
0
)))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment