remove dep on python_2_unicode_compatible

python_2_unicode_compatible is not available in all Django versions
This commit is contained in:
Paul Oswald 2014-08-07 15:48:29 +09:00
parent 66fa40c300
commit 192201d584

View File

@ -2,7 +2,6 @@
from __future__ import unicode_literals
from django.test import TestCase
from django.utils.encoding import python_2_unicode_compatible
from rest_framework.compat import apply_markdown, smart_text
from rest_framework.views import APIView
from rest_framework.tests.description import ViewWithNonASCIICharactersInDocstring
@ -108,17 +107,18 @@ 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
def __str__(self):
return self.s
def __unicode__(self):
return self.s
class MockView(APIView):
__doc__ = MockLazyStr("a gettext string")
__doc__ = MockLazyStr(u"a gettext string")
self.assertEqual(MockView().get_view_description(), 'a gettext string')
self.assertEqual(MockView().get_view_description(), u'a gettext string')
def test_markdown(self):
"""