Skip to content

description.py codes and tests removal #4153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 1, 2016
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions tests/description.py
Original file line number Diff line number Diff line change
@@ -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
16 changes: 2 additions & 14 deletions tests/test_description.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should be removed for pylint to be happy



# We check that docstrings get nicely un-indented.
Expand Down Expand Up @@ -85,16 +83,6 @@ class MockView(APIView):

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,
Expand Down