From 3db45cb94d4ad2811f2bae9b8ac4c6c2ce2128af Mon Sep 17 00:00:00 2001 From: Asif Saifuddin Auvi Date: Wed, 1 Jun 2016 00:39:01 +0600 Subject: [PATCH 1/4] removed description codes as it seems to be python 2.6 issue --- tests/description.py | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/tests/description.py b/tests/description.py index 55a55a9f6..e69de29bb 100644 --- a/tests/description.py +++ b/tests/description.py @@ -1,25 +0,0 @@ -# -- coding: utf-8 -- - -# Apparently there is a python 2.6 issue where docstrings of imported view classes -# do not retain their encoding information even if a module has a proper -# encoding declaration at the top of its source file. Therefore for tests -# to catch unicode related errors, a mock view has to be declared in a separate -# module. - -from rest_framework.views import APIView - -# test strings snatched from http://www.columbia.edu/~fdc/utf8/, -# http://winrus.com/utf8-jap.htm and memory -UTF8_TEST_DOCSTRING = ( - 'zażółć gęślą jaźń' - 'Sîne klâwen durh die wolken sint geslagen' - 'Τη γλώσσα μου έδωσαν ελληνική' - 'யாமறிந்த மொழிகளிலே தமிழ்மொழி' - 'На берегу пустынных волн' - 'てすと' - 'アイウエオカキクケコサシスセソタチツテ' -) - - -class ViewWithNonASCIICharactersInDocstring(APIView): - __doc__ = UTF8_TEST_DOCSTRING From 91bb17770e27fc39e3e46754533146429e8b7671 Mon Sep 17 00:00:00 2001 From: Asif Saifuddin Auvi Date: Wed, 1 Jun 2016 00:43:37 +0600 Subject: [PATCH 2/4] removed description tests unicode related functions --- tests/test_description.py | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/tests/test_description.py b/tests/test_description.py index d0ca40762..b30b9d83e 100644 --- a/tests/test_description.py +++ b/tests/test_description.py @@ -3,14 +3,12 @@ from __future__ import unicode_literals from django.test import TestCase -from django.utils.encoding import python_2_unicode_compatible, smart_text +from django.utils.encoding import python_2_unicode_compatible from rest_framework.compat import apply_markdown from rest_framework.views import APIView -from .description import ( - UTF8_TEST_DOCSTRING, ViewWithNonASCIICharactersInDocstring -) + # We check that docstrings get nicely un-indented. @@ -85,16 +83,6 @@ class TestViewNamesAndDescriptions(TestCase): self.assertEqual(MockView().get_view_description(), DESCRIPTION) - def test_view_description_supports_unicode(self): - """ - Unicode in docstrings should be respected. - """ - - self.assertEqual( - ViewWithNonASCIICharactersInDocstring().get_view_description(), - smart_text(UTF8_TEST_DOCSTRING) - ) - def test_view_description_can_be_empty(self): """ Ensure that if a view has no docstring, From 4fabdee4a3e5425619b516b5b2200c0c16d235d7 Mon Sep 17 00:00:00 2001 From: Asif Saifuddin Auvi Date: Wed, 1 Jun 2016 02:04:38 +0600 Subject: [PATCH 3/4] fix lint error --- tests/test_description.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/test_description.py b/tests/test_description.py index b30b9d83e..1683e106b 100644 --- a/tests/test_description.py +++ b/tests/test_description.py @@ -9,8 +9,6 @@ from rest_framework.compat import apply_markdown from rest_framework.views import APIView - - # We check that docstrings get nicely un-indented. DESCRIPTION = """an example docstring ==================== From eef94856d83fab9e21ece061a53d947bfb024a76 Mon Sep 17 00:00:00 2001 From: Asif Saifuddin Auvi Date: Wed, 1 Jun 2016 10:24:29 +0600 Subject: [PATCH 4/4] deleted description.py as unneeded --- tests/description.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 tests/description.py diff --git a/tests/description.py b/tests/description.py deleted file mode 100644 index e69de29bb..000000000