fix test for OrderedDict

This commit is contained in:
kazmiruk 2015-04-22 13:33:58 +07:00
parent 51650f88b7
commit e4e3f57321
2 changed files with 5 additions and 5 deletions

View File

@ -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

View File

@ -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)))