#NEWLINE# def doctestFriendly( func ) : #NEWLINE# #INDENT# '\n    Decorator which prepares maya to run doctests.\n    ' #NEWLINE# def prepForDoctest( * args , **kwargs ) : #NEWLINE# #INDENT# result = None #NEWLINE# if ( ( sys . displayhook != sys . __displayhook__ ) or ( sys . stdout != sys . __stdout__ ) ) : #NEWLINE# #INDENT# save_displayhook = sys . displayhook #NEWLINE# try : #NEWLINE# #INDENT# savedMaster = doctest . master #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# savedMaster = None #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# sys . displayhook = sys . __displayhook__ #NEWLINE# doctest . master = None #NEWLINE# try : #NEWLINE# #INDENT# result = func ( * args , ** kwargs ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# #UNINDENT# finally : #NEWLINE# #INDENT# sys . displayhook = save_displayhook #NEWLINE# doctest . master = savedMaster #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# result = func ( * args , ** kwargs ) #NEWLINE# #UNINDENT# return result #NEWLINE# #UNINDENT# return func