Cython has moved to github.
cython-devel
view tests/run/r_docstrings.pyx @ 1622:4f0327bdebc9
test for temp allocation bug in call
| author | Robert Bradshaw <robertwb@math.washington.edu> |
|---|---|
| date | Sat Jan 17 01:25:34 2009 -0800 (3 years ago) |
| parents | 926aaae7ac28 |
| children | ea31d3be11ce |
line source
1 # Some comments first
4 # More comments
6 u'A module docstring'
8 doctest = u"""# Python 3 gets all of these right ...
9 >>> __doc__
10 'A module docstring'
12 >>> f.__doc__
13 'This is a function docstring.'
15 >>> C.__doc__
16 u'This is a class docstring.'
17 >>> CS.__doc__
18 u'This is a subclass docstring.'
19 >>> print(CSS.__doc__)
20 None
22 >>> T.__doc__
23 'This is an extension type docstring.'
24 >>> TS.__doc__
25 'This is an extension subtype docstring.'
26 >>> TSS.__doc__
28 Compare with standard Python:
30 >>> def f():
31 ... u'This is a function docstring.'
32 >>> f.__doc__
33 u'This is a function docstring.'
35 >>> class C:
36 ... u'This is a class docstring.'
37 >>> class CS(C):
38 ... u'This is a subclass docstring.'
39 >>> class CSS(CS):
40 ... pass
42 >>> C.__doc__
43 u'This is a class docstring.'
44 >>> CS.__doc__
45 u'This is a subclass docstring.'
46 >>> CSS.__doc__
47 """
49 import sys
50 if sys.version_info[0] >= 3:
51 doctest = doctest.replace(u" u'", u" '")
53 __test__ = {u"test_docstrings" : doctest}
55 def f():
56 u"This is a function docstring."
58 class C:
59 u"This is a class docstring."
61 class CS(C):
62 u"This is a subclass docstring."
64 class CSS(CS):
65 pass
67 cdef class T:
68 u"This is an extension type docstring."
70 cdef class TS(T):
71 u"This is an extension subtype docstring."
73 cdef class TSS(TS):
74 pass
