title: Python: using doctests for classes
body: <p>Is it possible to use Python's doctest concept for classes, not just functions?</p>
  
  <p>If so, where shall I put the doctests - at the class' docstring, or at the constructor's docstring?</p>
  
  <p>To clarify, I'm looking for something like:</p>
  
  <pre><code>class Test:
      """
      &gt;&gt;&gt; a=Test(5)
      &gt;&gt;&gt; a.multiply_by_2()
      10
      """
      def __init__(self, number):
          self._number=number
  
      def multiply_by_2(self):
          return self._number*2
  </code></pre>
  
  <p>Thanks in advance,</p>
  
  <p>Adam</p>