from twisted.protocols.basic import LineOnlyReceiver from twisted.test.proto_helpers import StringTransport from _protocol import makeMain class LineOnlyReceiver(LineOnlyReceiver): transport = StringTransport() def lineReceived(self, line): pass main = makeMain(LineOnlyReceiver, ((b"a" * 50) + b"\r\n") * 1000) main.__module__ = "only-lines" if __name__ == '__main__': import sys import lineonlyreceiver from benchlib import driver driver(lineonlyreceiver.main, sys.argv)
import struct from twisted.protocols.basic import Int16StringReceiver from _protocol import makeMain class Int16StringReceiver(Int16StringReceiver): def stringReceived(self, s): pass main = makeMain(Int16StringReceiver, (struct.pack("!H", 50) + b"a" * 50) * 1000) main.__module__ = "int16strings" if __name__ == '__main__': import sys import int16receiver from benchlib import driver driver(int16receiver.main, sys.argv)
from twisted.protocols.basic import LineReceiver from _protocol import makeMain class LineReceiver(LineReceiver): def lineReceived(self, line): pass main = makeMain(LineReceiver, (("a" * 50) + "\r\n") * 1000) main.__module__ = "lines" if __name__ == '__main__': import sys import linereceiver from benchlib import driver driver(linereceiver.main, sys.argv)