Back to index

python3.2  3.2.2
Classes | Public Member Functions | Public Attributes | Static Public Attributes | Properties
test.test_doctest.SampleClass Class Reference

List of all members.

Classes

class  NestedClass

Public Member Functions

def __init__
def double
def get
def a_staticmethod
def a_classmethod

Public Attributes

 val

Static Public Attributes

tuple a_staticmethod = staticmethod(a_staticmethod)
tuple a_classmethod = classmethod(a_classmethod)

Properties

 a_property = property(get, doc=""" >>> print(SampleClass(22).a_property) 22 """)

Detailed Description

>>> print(1)
1

>>> # comments get ignored.  so are empty PS1 and PS2 prompts:
>>>
...

Multiline example:
>>> sc = SampleClass(3)
>>> for i in range(10):
...     sc = sc.double()
...     print(' ', sc.get(), sep='', end='')
 6 12 24 48 96 192 384 768 1536 3072

Definition at line 28 of file test_doctest.py.


Constructor & Destructor Documentation

def test.test_doctest.SampleClass.__init__ (   self,
  val 
)
>>> print(SampleClass(12).get())
12

Definition at line 44 of file test_doctest.py.

00044 
00045     def __init__(self, val):
00046         """
00047         >>> print(SampleClass(12).get())
00048         12
00049         """
00050         self.val = val

Here is the caller graph for this function:


Member Function Documentation

>>> print(SampleClass.a_classmethod(10))
12
>>> print(SampleClass(0).a_classmethod(10))
12

Definition at line 73 of file test_doctest.py.

00073 
00074     def a_classmethod(cls, v):
00075         """
00076         >>> print(SampleClass.a_classmethod(10))
00077         12
00078         >>> print(SampleClass(0).a_classmethod(10))
00079         12
00080         """
        return v+2
>>> print(SampleClass.a_staticmethod(10))
11

Definition at line 65 of file test_doctest.py.

00065 
00066     def a_staticmethod(v):
00067         """
00068         >>> print(SampleClass.a_staticmethod(10))
00069         11
00070         """
        return v+1
>>> print(SampleClass(12).double().get())
24

Definition at line 51 of file test_doctest.py.

00051 
00052     def double(self):
00053         """
00054         >>> print(SampleClass(12).double().get())
00055         24
00056         """
00057         return SampleClass(self.val + self.val)

>>> print(SampleClass(-5).get())
-5

Definition at line 58 of file test_doctest.py.

00058 
00059     def get(self):
00060         """
00061         >>> print(SampleClass(-5).get())
00062         -5
00063         """
00064         return self.val

Here is the caller graph for this function:


Member Data Documentation

Definition at line 81 of file test_doctest.py.

Definition at line 71 of file test_doctest.py.

Definition at line 49 of file test_doctest.py.


Property Documentation

test.test_doctest.SampleClass.a_property = property(get, doc=""" >>> print(SampleClass(22).a_property) 22 """) [static]

Definition at line 83 of file test_doctest.py.


The documentation for this class was generated from the following file: