Commit 192201d5 by Paul Oswald

remove dep on python_2_unicode_compatible

python_2_unicode_compatible is not available in all Django versions
parent 66fa40c3
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.test import TestCase 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.compat import apply_markdown, smart_text
from rest_framework.views import APIView from rest_framework.views import APIView
from rest_framework.tests.description import ViewWithNonASCIICharactersInDocstring from rest_framework.tests.description import ViewWithNonASCIICharactersInDocstring
...@@ -108,17 +107,18 @@ class TestViewNamesAndDescriptions(TestCase): ...@@ -108,17 +107,18 @@ class TestViewNamesAndDescriptions(TestCase):
""" """
# use a mock object instead of gettext_lazy to ensure that we can't end # 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 # up with a test case string in our l10n catalog
@python_2_unicode_compatible
class MockLazyStr(object): class MockLazyStr(object):
def __init__(self, string): def __init__(self, string):
self.s = string self.s = string
def __str__(self): def __str__(self):
return self.s return self.s
def __unicode__(self):
return self.s
class MockView(APIView): 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): def test_markdown(self):
""" """
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment