Ticket #4386: 4386.patch

File 4386.patch, 1.9 KB (added by moijes12, 2 years ago)

Please find attached the patch. I felt I should have created class FiledescriptorTests which contains tests for writeSequence and checks for implementing IPushProducer. Would something like that be ok ?

  • twisted/topfiles/4386.bugfix

     
     1twisted.internet.abstract.FileDescriptor now implements twisted.internet.interfaces.IPushProducer instead of twisted.internet.interfaces.IProducer. 
  • twisted/internet/abstract.py

     
    155155 
    156156    SEND_LIMIT = 128*1024 
    157157 
    158     implements(interfaces.IProducer, interfaces.IReadWriteDescriptor, 
     158    implements(interfaces.IPushProducer, interfaces.IReadWriteDescriptor, 
    159159               interfaces.IConsumer, interfaces.ITransport, interfaces.IHalfCloseableDescriptor) 
    160160 
    161161    def __init__(self, reactor=None): 
  • twisted/internet/test/test_filedescriptor.py

     
    55Whitebox tests for L{twisted.internet.abstract.FileDescriptor}. 
    66""" 
    77 
     8from zope.interface.verify import verifyObject 
     9 
    810from twisted.internet.abstract import FileDescriptor 
     11from twisted.internet.interfaces import IPushProducer 
    912from twisted.trial.unittest import TestCase 
    1013 
    1114 
    1215 
     16class FileDescriptorImplementsIPushProducerTests(TestCase): 
     17    """ 
     18    Test to check that L{FileDescriptor} implements L{IPushProducer}. 
     19    """ 
     20    def test_fileDescriptorImplementsIPushProducer(self): 
     21        """ 
     22        L{Filedescriptor} should implement L{IPushProducer}. 
     23        """ 
     24        fileDescriptor = FileDescriptor() 
     25        self.assertTrue(verifyObject(IPushProducer, fileDescriptor)) 
     26 
     27 
    1328class FileDescriptorWriteSequenceTests(TestCase): 
    1429    """ 
    1530    Tests for L{FileDescriptor.writeSequence}.