mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-26 03:23:59 +03:00
fix test for OrderedDict
This commit is contained in:
parent
51650f88b7
commit
e4e3f57321
|
@ -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 = SortedDict()
|
||||
ret = OrderedDict()
|
||||
ret['c'] = 1
|
||||
ret['b'] = 1
|
||||
ret['a'] = 1
|
||||
|
|
|
@ -1297,7 +1297,7 @@ class SerializerPickleTests(TestCase):
|
|||
|
||||
def test_pickle_inner_serializer(self):
|
||||
"""
|
||||
Test pickling a serializer whose resulting .data (a SortedDictWithMetadata) will
|
||||
Test pickling a serializer whose resulting .data (a OrderedDictWithMetadata) 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.SortedDict({1: 1}))
|
||||
self.assertEqual(data.__getstate__(), serializers.OrderedDict({1: 1}))
|
||||
|
||||
def test_serializer_data_is_pickleable(self):
|
||||
"""
|
||||
Another regression test for #645.
|
||||
"""
|
||||
data = serializers.SortedDictWithMetadata({1: 1})
|
||||
data = serializers.OrderedDictWithMetadata({1: 1})
|
||||
repr(pickle.loads(pickle.dumps(data, 0)))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user