<s> from paste . fixture import * <EOL> try : <EOL> from paste . debug . profile import * <EOL> disable = False <EOL> except ImportError : <EOL> disable = True <EOL> if not disable : <EOL> def simple_app ( environ , start_response ) : <EOL> start_response ( '<STR_LIT>' , [ ( '<STR_LIT>' , '<STR_LIT>' ) ] ) <EOL> return [ '<STR_LIT>' ] <EOL> def long_func ( ) : <EOL> for i in range ( <NUM_LIT:1000> ) : <EOL> pass <EOL> return '<STR_LIT:test>' <EOL> def test_profile ( ) : <EOL> app = TestApp ( ProfileMiddleware ( simple_app , { } ) ) <EOL> res = app . get ( '<STR_LIT:/>' ) <EOL> res . mustcontain ( '<STR_LIT>' ) <EOL> res . mustcontain ( '<STR_LIT>' ) <EOL> def test_decorator ( ) : <EOL> value = profile_decorator ( ) ( long_func ) ( ) <EOL> assert value == '<STR_LIT:test>' </s>
