From e4e3f57321e7f32b889ccb7d1bfc354eb1cbd101 Mon Sep 17 00:00:00 2001 From: kazmiruk Date: Wed, 22 Apr 2015 13:33:58 +0700 Subject: [PATCH] fix test for OrderedDict --- tests/test_fields.py | 4 ++-- tests/test_serializer.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_fields.py b/tests/test_fields.py index 0ddbe48b5..807676230 100644 --- a/tests/test_fields.py +++ b/tests/test_fields.py @@ -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 diff --git a/tests/test_serializer.py b/tests/test_serializer.py index e72b723f0..c0de5cf27 100644 --- a/tests/test_serializer.py +++ b/tests/test_serializer.py @@ -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)))