fixes tests for renamed SortedDict

This commit is contained in:
kazmiruk 2015-04-23 16:32:36 +07:00
parent be66e15c1c
commit 73e433ed5c
2 changed files with 3 additions and 7 deletions

View File

@ -11,13 +11,9 @@ from django.core import validators
from django.db import models
from django.test import TestCase
from rest_framework import serializers
from rest_framework.compat import SortedDict
from tests.models import RESTFrameworkModel
try:
from collections import OrderedDict
except ImportError:
from django.utils.datastructures import SortedDict as OrderedDict
class TimestampedModel(models.Model):
added = models.DateTimeField(auto_now_add=True)
@ -99,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 = OrderedDict()
ret = SortedDict()
ret['c'] = 1
ret['b'] = 1
ret['a'] = 1

View File

@ -1312,7 +1312,7 @@ class SerializerPickleTests(TestCase):
Regression test for #645.
"""
data = serializers.DictWithMetadata({1: 1})
self.assertEqual(data.__getstate__(), serializers.OrderedDict({1: 1}))
self.assertEqual(data.__getstate__(), serializers.SortedDict({1: 1}))
def test_serializer_data_is_pickleable(self):
"""