#NEWLINE# def test_unwatch_log( self ) : #NEWLINE# #INDENT# stream_handler = logging . StreamHandler ( ) #NEWLINE# logger = logging . Logger ( 'fake' ) #NEWLINE# logger . addHandler ( stream_handler ) #NEWLINE# logger . addHandler ( handlers . WatchedFileHandler ( '/tmp/filename1' ) ) #NEWLINE# with mock . patch ( 'logging.getLogger' , return_value = logger ) : #NEWLINE# #INDENT# daemon . unwatch_log ( ) #NEWLINE# self . assertEqual ( 2 , len ( logger . handlers ) ) #NEWLINE# logger . handlers . remove ( stream_handler ) #NEWLINE# observed = logger . handlers [ 0 ] #NEWLINE# self . assertEqual ( logging . FileHandler , type ( observed ) ) #NEWLINE# self . assertEqual ( '/tmp/filename1' , observed . baseFilename )