#NEWLINE# def test_dataReceived( self ) : #NEWLINE# #INDENT# '\n        The L{IProtocol} provider passed to L{Response.deliverBody} has its\n        C{dataReceived} method called with bytes received as part of the\n        response body.\n        ' #NEWLINE# bytes = [ ] #NEWLINE# class ListConsumer ( Protocol ) : #NEWLINE# #INDENT# def dataReceived( self , data ) : #NEWLINE# #INDENT# bytes . append ( data ) #NEWLINE# #UNINDENT# #UNINDENT# consumer = ListConsumer ( ) #NEWLINE# response = justTransportResponse ( StringTransport ( ) ) #NEWLINE# response . deliverBody ( consumer ) #NEWLINE# response . _bodyDataReceived ( b'foo' ) #NEWLINE# self . assertEqual ( bytes , [ b'foo' ] )