#NEWLINE# def test_invalid_headers( self ) : #NEWLINE# #INDENT# req = b'GET / HTTP/1.1\r\nContent-Type text/html\r\n\r\n' #NEWLINE# transport = unittest . mock . Mock ( ) #NEWLINE# transport . get_extra_info . return_value = ( '127.0.0.1' , 1 ) #NEWLINE# stream = asyncio . StreamReader ( loop = self . loop ) #NEWLINE# stream . set_transport ( transport ) #NEWLINE# task = asyncio . Task ( HttpParser . parse ( stream ) , loop = self . loop ) #NEWLINE# self . loop . call_soon ( ( lambda : stream . feed_data ( req ) ) ) #NEWLINE# self . assertRaises ( BadRequestException , self . loop . run_until_complete , task )