#NEWLINE# def test_duplicateWarningCollected( self ) : #NEWLINE# #INDENT# '\n        Subsequent emissions of a warning from a particular source site can be\n        collected by L{_collectWarnings}.  In particular, the per-module\n        emitted-warning cache should be bypassed (I{__warningregistry__}).\n        ' #NEWLINE# global __warningregistry__ #NEWLINE# del __warningregistry__ #NEWLINE# def f( ) : #NEWLINE# #INDENT# warnings . warn ( 'foo' ) #NEWLINE# #UNINDENT# warnings . simplefilter ( 'default' ) #NEWLINE# f ( ) #NEWLINE# events = [ ] #NEWLINE# _collectWarnings ( events . append , f ) #NEWLINE# self . assertEqual ( len ( __warningregistry__ ) , 1 ) #NEWLINE# self . assertEqual ( events [ 0 ] . message , 'foo' ) #NEWLINE# self . assertEqual ( len ( self . flushWarnings ( ) ) , 1 )