Commit db2166de authored by Stefan Behnel's avatar Stefan Behnel

extended (failing) test cases

parent 62335406
...@@ -10,40 +10,46 @@ doctest = u"""# Python 3 gets all of these right ... ...@@ -10,40 +10,46 @@ doctest = u"""# Python 3 gets all of these right ...
'A module docstring' 'A module docstring'
>>> f.__doc__ >>> f.__doc__
'This is a function docstring.' '\\n This is a function docstring.\\n '
>>> C.__doc__ >>> C.__doc__
'This is a class docstring.' '\\n This is a class docstring.\\n '
>>> CS.__doc__ >>> CS.__doc__
'This is a subclass docstring.' '\\n This is a subclass docstring.\\n '
>>> print(CSS.__doc__) >>> print(CSS.__doc__)
None None
>>> T.__doc__ >>> T.__doc__
'This is an extension type docstring.' '\\n This is an extension type docstring.\\n '
>>> TS.__doc__ >>> TS.__doc__
'This is an extension subtype docstring.' '\\n This is an extension subtype docstring.\\n '
>>> TSS.__doc__ >>> TSS.__doc__
Compare with standard Python: Compare with standard Python:
>>> def f(): >>> def Pyf():
... u'This is a function docstring.' ... u'''
>>> f.__doc__ ... This is a function docstring.
u'This is a function docstring.' ... '''
>>> Pyf.__doc__
>>> class C: u'\\n This is a function docstring.\\n '
... u'This is a class docstring.'
>>> class CS(C): >>> class PyC:
... u'This is a subclass docstring.' ... u'''
>>> class CSS(CS): ... This is a class docstring.
... '''
>>> class PyCS(C):
... u'''
... This is a subclass docstring.
... '''
>>> class PyCSS(CS):
... pass ... pass
>>> C.__doc__ >>> PyC.__doc__
u'This is a class docstring.' u'\\n This is a class docstring.\\n '
>>> CS.__doc__ >>> PyCS.__doc__
u'This is a subclass docstring.' u'\\n This is a subclass docstring.\\n '
>>> CSS.__doc__ >>> PyCSS.__doc__
""" """
import sys import sys
...@@ -53,22 +59,32 @@ if sys.version_info[0] >= 3: ...@@ -53,22 +59,32 @@ if sys.version_info[0] >= 3:
__test__ = {u"test_docstrings" : doctest} __test__ = {u"test_docstrings" : doctest}
def f(): def f():
u"This is a function docstring." u"""
This is a function docstring.
"""
class C: class C:
u"This is a class docstring." u"""
This is a class docstring.
"""
class CS(C): class CS(C):
u"This is a subclass docstring." u"""
This is a subclass docstring.
"""
class CSS(CS): class CSS(CS):
pass pass
cdef class T: cdef class T:
u"This is an extension type docstring." u"""
This is an extension type docstring.
"""
cdef class TS(T): cdef class TS(T):
u"This is an extension subtype docstring." u"""
This is an extension subtype docstring.
"""
cdef class TSS(TS): cdef class TSS(TS):
pass pass
...@@ -148,9 +148,9 @@ __doc__ = ur""" ...@@ -148,9 +148,9 @@ __doc__ = ur"""
... sys.version_info[0] >= 3 and ord(str_uescape[-2]) or str_uescape[-12:-1]) ... sys.version_info[0] >= 3 and ord(str_uescape[-2]) or str_uescape[-12:-1])
True True
>>> newlines == "Aaa\n" >>> newlines
True 'Aaa\n'
>>> len(long_escapes) >>> len(long_escapes)
3033 3033
>>> len(even_lots_of_slashes) >>> len(even_lots_of_slashes)
......
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