#NEWLINE# def test_exception_handler_specific_level( logger ) : #NEWLINE# #INDENT# from logbook.more import ExceptionHandler #NEWLINE# with logbook . TestHandler ( ) as test_handler : #NEWLINE# #INDENT# with pytest . raises ( ValueError ) as caught : #NEWLINE# #INDENT# with ExceptionHandler ( ValueError , level = 'WARNING' ) : #NEWLINE# #INDENT# logger . info ( 'this is irrelevant' ) #NEWLINE# logger . warn ( 'here i am' ) #NEWLINE# #UNINDENT# #UNINDENT# assert ( 'WARNING: testlogger: here i am' in test_handler . value . args [ 0 ] ) #NEWLINE# #UNINDENT# assert ( 'this is irrelevant' in test_handler . records [ 0 ] . message )