#NEWLINE# @ defer . inlineCallbacks #NEWLINE# def test_middleware_works( self ) : #NEWLINE# #INDENT# crawler = get_crawler ( _HttpErrorSpider ) #NEWLINE# ( yield crawler . crawl ( ) ) #NEWLINE# assert ( not crawler . spider . skipped ) , crawler . spider . skipped #NEWLINE# self . assertEqual ( self . spider . parsed , { '200' } ) #NEWLINE# self . assertEqual ( crawler . spider . failed , { '404' , '402' , '500' } )