#NEWLINE# def test_dedup_handler( logger ) : #NEWLINE# #INDENT# from logbook.more import DedupHandler #NEWLINE# with logbook . TestHandler ( ) as test_handler : #NEWLINE# #INDENT# with DedupHandler ( ) : #NEWLINE# #INDENT# logger . info ( 'foo' ) #NEWLINE# logger . info ( 'bar' ) #NEWLINE# logger . info ( 'foo' ) #NEWLINE# #UNINDENT# #UNINDENT# assert ( 2 == len ( test_handler . records ) ) #NEWLINE# assert ( 'message repeated 2 times: foo' in test_handler . records [ 0 ] . message ) #NEWLINE# assert ( 'message repeated 1 times: bar' in test_handler . records [ 1 ] . message )