[code.view]

[top] / python / PyMOTW / doctest / doctest_tracebacks.py

     #!/usr/bin/env python
     # encoding: utf-8
     #
     # Copyright (c) 2010 Doug Hellmann.  All rights reserved.
     #
     """Expecting exceptions
     """
     #end_pymotw_header
     
     def this_raises():
         """This function always raises an exception.
     
         >>> this_raises()
         Traceback (most recent call last):
           File "<stdin>", line 1, in <module>
           File "/no/such/path/doctest_tracebacks.py", line 14, in this_raises
             raise RuntimeError('here is the error')
         RuntimeError: here is the error
         """
         raise RuntimeError('here is the error')
     
     
     

[top] / python / PyMOTW / doctest / doctest_tracebacks.py

contact | logmethods.com