#NEWLINE# def test_filteredOnceWarning( self ) : #NEWLINE# #INDENT# '\n        L{deprecate.warnAboutFunction} emits a warning that will be filtered\n        once if L{warnings.filterwarning} is called with the module name of the\n        deprecated function and an action of once.\n        ' #NEWLINE# del warnings . filters [ : ] #NEWLINE# warnings . filterwarnings ( action = 'module' , module = 'twisted_private_helper' ) #NEWLINE# from twisted_private_helper import module #NEWLINE# module . callTestFunction ( ) #NEWLINE# module . callTestFunction ( ) #NEWLINE# warningsShown = self . flushWarnings ( ) #NEWLINE# self . assertEqual ( len ( warningsShown ) , 1 ) #NEWLINE# message = warningsShown [ 0 ] [ 'message' ] #NEWLINE# category = warningsShown [ 0 ] [ 'category' ] #NEWLINE# filename = warningsShown [ 0 ] [ 'filename' ] #NEWLINE# lineno = warningsShown [ 0 ] [ 'lineno' ] #NEWLINE# msg = warnings . formatwarning ( message , category , filename , lineno ) #NEWLINE# self . assertTrue ( msg . endswith ( 'module.py:9: DeprecationWarning: A Warning String\n  return a\n' ) , ( 'Unexpected warning string: %r' % ( msg , ) ) )