""" >>> def test(): ... print "hello" ... raise Exception() ... >>> test() hello Traceback (most recent call last): ... Exception """ def _test(): import doctest doctest.testmod() if __name__ == "__main__": _test()