mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-10 19:56:59 +03:00
fixes tests for renamed SortedDict
This commit is contained in:
parent
be66e15c1c
commit
73e433ed5c
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue
Block a user