#NEWLINE# def run_doctest( module , verbosity = None , optionflags = 0 ) : #NEWLINE# #INDENT# "Run doctest on the given module.  Return (#failures, #tests).\n\n    If optional argument verbosity is not specified (or is None), pass\n    support's belief about verbosity on to doctest.  Else doctest's\n    usual behavior is used (it searches sys.argv for -v).\n    " #NEWLINE# import doctest #NEWLINE# if ( verbosity is None ) : #NEWLINE# #INDENT# verbosity = verbose #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# verbosity = None #NEWLINE# #UNINDENT# ( f , t ) = doctest . testmod ( module , verbose = verbosity , optionflags = optionflags ) #NEWLINE# if f : #NEWLINE# #INDENT# raise TestFailed ( ( '%d of %d doctests failed' % ( optionflags , t ) ) ) #NEWLINE# #UNINDENT# if verbose : #NEWLINE# #INDENT# print ( ( 'doctest (%s) ... %d tests with zero failures' % ( module . __name__ , t ) ) ) #NEWLINE# #UNINDENT# return ( f , t )