#NEWLINE# def test_before_and_after_import( self ) : #NEWLINE# #INDENT# invoked_one = [ ] #NEWLINE# invoked_two = [ ] #NEWLINE# @ wrapt . when_imported ( 'this' ) #NEWLINE# def hook_this_one( module ) : #NEWLINE# #INDENT# self . assertEqual ( module . __name__ , 'this' ) #NEWLINE# invoked_one . append ( 1 ) #NEWLINE# #UNINDENT# self . assertEqual ( len ( invoked_one ) , 0 ) #NEWLINE# self . assertEqual ( len ( invoked_two ) , 0 ) #NEWLINE# import this #NEWLINE# self . assertEqual ( len ( invoked_one ) , 1 ) #NEWLINE# self . assertEqual ( len ( invoked_two ) , 0 ) #NEWLINE# @ wrapt . when_imported ( 'this' ) #NEWLINE# def hook_this_two( module ) : #NEWLINE# #INDENT# self . assertEqual ( module . __name__ , 'this' ) #NEWLINE# invoked_two . append ( 1 ) #NEWLINE# #UNINDENT# self . assertEqual ( len ( invoked_one ) , 1 ) #NEWLINE# self . assertEqual ( len ( self ) , 1 )