

def test_forProtocol(self):
    '\n        L{Factory.forProtocol} constructs a Factory, passing along any\n        additional arguments, and sets its C{protocol} attribute to the given\n        Protocol subclass.\n        '

    class ArgTakingFactory(Factory):

        def __init__(self, *args, **kwargs):
            (self.args, self.kwargs) = (args, kwargs)
    factory = ArgTakingFactory.forProtocol(Protocol, 1, 2, foo=12)
    self.assertEqual(factory.protocol, Protocol)
    self.assertEqual(factory.args, (1, 2))
    self.assertEqual(factory.kwargs, {
        'foo': 12,
    })

dataset/ETHPy150Open twisted/twisted/twisted/internet/test/test_protocol.py FactoryTests.test_forProtocol/original