aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTom Christie2014-12-05 13:14:14 +0000
committerTom Christie2014-12-05 13:14:14 +0000
commit65d6cba75f9db0995020f01e9144b6660feb47d6 (patch)
tree1212187336ad9f887a4c69dc805506d49f42b86e /tests
parent9fb1b396db751234a531dabacb6758ac2645776c (diff)
parentd9930181ee157f51e2fcea33a3af5ea397647324 (diff)
downloaddjango-rest-framework-65d6cba75f9db0995020f01e9144b6660feb47d6.tar.bz2
Merge pull request #2200 from maryokhin/master
Clean up compat code
Diffstat (limited to 'tests')
-rw-r--r--tests/test_description.py7
-rw-r--r--tests/test_multitable_inheritance.py2
-rw-r--r--tests/test_parsers.py2
-rw-r--r--tests/test_relations_generic.py2
-rw-r--r--tests/test_renderers.py4
-rw-r--r--tests/test_request.py2
-rw-r--r--tests/test_validators.py2
7 files changed, 11 insertions, 10 deletions
diff --git a/tests/test_description.py b/tests/test_description.py
index 0675d209..78ce2350 100644
--- a/tests/test_description.py
+++ b/tests/test_description.py
@@ -2,7 +2,8 @@
from __future__ import unicode_literals
from django.test import TestCase
-from rest_framework.compat import apply_markdown, smart_text
+from django.utils.encoding import python_2_unicode_compatible, smart_text
+from rest_framework.compat import apply_markdown
from rest_framework.views import APIView
from .description import ViewWithNonASCIICharactersInDocstring
from .description import UTF8_TEST_DOCSTRING
@@ -107,6 +108,7 @@ class TestViewNamesAndDescriptions(TestCase):
"""
# use a mock object instead of gettext_lazy to ensure that we can't end
# up with a test case string in our l10n catalog
+ @python_2_unicode_compatible
class MockLazyStr(object):
def __init__(self, string):
self.s = string
@@ -114,9 +116,6 @@ class TestViewNamesAndDescriptions(TestCase):
def __str__(self):
return self.s
- def __unicode__(self):
- return self.s
-
class MockView(APIView):
__doc__ = MockLazyStr("a gettext string")
diff --git a/tests/test_multitable_inheritance.py b/tests/test_multitable_inheritance.py
index ce1bf3ea..e1b40cc7 100644
--- a/tests/test_multitable_inheritance.py
+++ b/tests/test_multitable_inheritance.py
@@ -31,7 +31,7 @@ class AssociatedModelSerializer(serializers.ModelSerializer):
# Tests
-class IneritedModelSerializationTests(TestCase):
+class InheritedModelSerializationTests(TestCase):
def test_multitable_inherited_model_fields_as_expected(self):
"""
diff --git a/tests/test_parsers.py b/tests/test_parsers.py
index 88eccef3..d28d8bd4 100644
--- a/tests/test_parsers.py
+++ b/tests/test_parsers.py
@@ -5,8 +5,8 @@ from django import forms
from django.core.files.uploadhandler import MemoryFileUploadHandler
from django.test import TestCase
from django.utils import unittest
+from django.utils.six.moves import StringIO
from rest_framework.compat import etree
-from rest_framework.compat import StringIO
from rest_framework.exceptions import ParseError
from rest_framework.parsers import FormParser, FileUploadParser
from rest_framework.parsers import XMLParser
diff --git a/tests/test_relations_generic.py b/tests/test_relations_generic.py
index 380ad91d..b600b333 100644
--- a/tests/test_relations_generic.py
+++ b/tests/test_relations_generic.py
@@ -3,8 +3,8 @@ from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.generic import GenericRelation, GenericForeignKey
from django.db import models
from django.test import TestCase
+from django.utils.encoding import python_2_unicode_compatible
from rest_framework import serializers
-from rest_framework.compat import python_2_unicode_compatible
@python_2_unicode_compatible
diff --git a/tests/test_renderers.py b/tests/test_renderers.py
index 61dd7c7a..00a24fb1 100644
--- a/tests/test_renderers.py
+++ b/tests/test_renderers.py
@@ -7,9 +7,11 @@ from django.core.cache import cache
from django.db import models
from django.test import TestCase
from django.utils import six, unittest
+from django.utils.six import BytesIO
+from django.utils.six.moves import StringIO
from django.utils.translation import ugettext_lazy as _
from rest_framework import status, permissions
-from rest_framework.compat import yaml, etree, StringIO, BytesIO
+from rest_framework.compat import yaml, etree
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework.renderers import BaseRenderer, JSONRenderer, YAMLRenderer, \
diff --git a/tests/test_request.py b/tests/test_request.py
index 44afd243..7cf8c327 100644
--- a/tests/test_request.py
+++ b/tests/test_request.py
@@ -187,7 +187,7 @@ class MockView(APIView):
if request.POST.get('example') is not None:
return Response(status=status.HTTP_200_OK)
- return Response(status=status.INTERNAL_SERVER_ERROR)
+ return Response(status=status.HTTP_500_INTERNAL_SERVER_ERROR)
urlpatterns = patterns(
'',
diff --git a/tests/test_validators.py b/tests/test_validators.py
index 1df0641c..5d92b284 100644
--- a/tests/test_validators.py
+++ b/tests/test_validators.py
@@ -148,7 +148,7 @@ class TestUniquenessTogetherValidation(TestCase):
def test_ignore_excluded_fields(self):
"""
When model fields are not included in a serializer, then uniqueness
- validtors should not be added for that field.
+ validators should not be added for that field.
"""
class ExcludedFieldSerializer(serializers.ModelSerializer):
class Meta: