#NEWLINE# def test_group_disabled( ) : #NEWLINE# #INDENT# group = logbook . LoggerGroup ( ) #NEWLINE# logger1 = logbook . Logger ( 'testlogger1' ) #NEWLINE# logger2 = logbook . Logger ( 'testlogger2' ) #NEWLINE# group . add_logger ( logger2 ) #NEWLINE# group . add_logger ( logger2 ) #NEWLINE# group . disable ( ) #NEWLINE# with logbook . TestHandler ( ) as handler : #NEWLINE# #INDENT# logger1 . warn ( 'Warning 1' ) #NEWLINE# logger2 . warn ( 'Warning 2' ) #NEWLINE# #UNINDENT# assert ( not handler . has_warnings ) #NEWLINE# group . enable ( ) #NEWLINE# with logbook . TestHandler ( ) as handler : #NEWLINE# #INDENT# logger1 . warn ( 'Warning 1' ) #NEWLINE# logger2 . warn ( 'Warning 2' ) #NEWLINE# #UNINDENT# assert handler . has_warning ( 'Warning 1' ) #NEWLINE# assert handler . has_warning ( 'Warning 2' ) #NEWLINE# group . disable ( ) #NEWLINE# logger1 . enable ( ) #NEWLINE# with logbook . TestHandler ( ) as handler : #NEWLINE# #INDENT# logger1 . warn ( 'Warning 1' ) #NEWLINE# logger2 . warn ( 'Warning 2' ) #NEWLINE# #UNINDENT# assert handler . has_warning ( 'Warning 1' ) #NEWLINE# assert ( not handler . has_warning ( 'Warning 2' ) ) #NEWLINE# group . disable ( force = True ) #NEWLINE# with logbook . TestHandler ( ) as handler : #NEWLINE# #INDENT# logger1 . warn ( 'Warning 1' ) #NEWLINE# logger2 . warn ( 'Warning 2' ) #NEWLINE# #UNINDENT# assert ( not handler . has_warning ( 'Warning 1' ) ) #NEWLINE# assert ( not handler . has_warning ( 'Warning 2' ) ) #NEWLINE# group . enable ( ) #NEWLINE# with logbook . TestHandler ( ) as handler : #NEWLINE# #INDENT# logger1 . warn ( 'Warning 1' ) #NEWLINE# logger2 . warn ( 'Warning 2' ) #NEWLINE# #UNINDENT# assert ( not handler . has_warning ( 'Warning 1' ) ) #NEWLINE# assert handler . has_warning ( 'Warning 2' ) #NEWLINE# group . enable ( force = True ) #NEWLINE# with logbook . TestHandler ( ) as handler : #NEWLINE# #INDENT# logger1 . warn ( 'Warning 1' ) #NEWLINE# logger2 . warn ( 'Warning 2' ) #NEWLINE# #UNINDENT# assert handler . has_warning ( 'Warning 1' ) #NEWLINE# assert handler . has_warning ( 'Warning 2' )