On 10:25 am, albert.bra...@weiermayer.com wrote: >On Thu, Mar 25, 2010 at 09:22:03AM +1100, Andrew Bennetts wrote: >> >>No; I think once loseConnection has been called dataReceived won't be >>called again, so there's no point checking for brokenPeer in >>dataReceived. > >There is a unittest that assumes that dataReceives still works after >sending in garbage: > > def test_illegal(self): > """ > Assert that illegal strings cause the transport to be closed. > """ > for s in self.illegalStrings: > r = self.getProtocol() > for c in s: > r.dataReceived(c) > self.assertTrue(r.transport.disconnecting) > >self.illegalStrings is defined as > > illegalStrings = [ > '9999999999999999999999', 'abc', '4:abcde', > '51:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab,',] > >In this implementation, the dataReceived method has to be functional >even after the NetstringReceiver has detected that the received >data are garbage.
I'm not sure about this. Each iteration around this loop creates a new instance of NetstringReceiver; after the illegal string is delivered, the instance isn't used again. So, are you sure this is testing what you think it's testing? Jean-Paul _______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python