def test_badapp():
 def badapp(environ, start_response):
  start_response('200 OK', [])
  raise HTTPBadRequest('Do not do this at home.')
 newapp = HTTPExceptionHandler(badapp)
 assert ('Bad Request' in ''.join(newapp({'HTTP_ACCEPT': 'text/html'}, (lambda a, b, c=None: None))))

def test_badapp ( ) : def badapp ( environ , start_response ) : start_response ( '200 OK' , [ ] ) raise HTTPBadRequest ( 'Do not do this at home.' ) newapp = HTTPExceptionHandler ( badapp ) assert ( 'Bad Request' in '' . join ( newapp ( { 'HTTP_ACCEPT' : 'text/html' } , ( lambda a , b , c = None : None ) ) ) )
verify that the middleware handles previously-started responses .