#NEWLINE# def test_sendRequestBodyWithTooFewBytes( self ) : #NEWLINE# #INDENT# '\n        If L{Request} is created with a C{bodyProducer} with a known length and\n        the producer does not produce that many bytes, the L{Deferred} returned\n        by L{Request.writeTo} fires with a L{Failure} wrapping a\n        L{WrongBodyLength} exception.\n        ' #NEWLINE# producer = StringProducer ( 3 ) #NEWLINE# request = Request ( b'POST' , b'/bar' , _boringHeaders , producer ) #NEWLINE# writeDeferred = request . writeTo ( writeDeferred . transport ) #NEWLINE# producer . consumer . write ( b'ab' ) #NEWLINE# producer . finished . callback ( None ) #NEWLINE# self . assertIdentical ( self . transport . producer , None ) #NEWLINE# return self . assertFailure ( writeDeferred , WrongBodyLength )