From 73e433ed5c6835e413a2ebabffedb16bd36f437b Mon Sep 17 00:00:00 2001 From: kazmiruk Date: Thu, 23 Apr 2015 16:32:36 +0700 Subject: [PATCH] fixes tests for renamed SortedDict --- tests/test_fields.py | 8 ++------ tests/test_serializer.py | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/tests/test_fields.py b/tests/test_fields.py index 261ef521c..058ad7035 100644 --- a/tests/test_fields.py +++ b/tests/test_fields.py @@ -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 diff --git a/tests/test_serializer.py b/tests/test_serializer.py index 14e88e6d2..e72b723f0 100644 --- a/tests/test_serializer.py +++ b/tests/test_serializer.py @@ -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): """