

def run_test_case(self, input_string, length_to_send, truncate_size=None):
    input_buffer = cStringIO.StringIO()
    input_buffer.write(struct.pack('!I', length_to_send))
    input_buffer.write(input_string)
    if (truncate_size is not None):
        input_buffer.truncate(truncate_size)
    num_bytes = input_buffer.tell()
    input_buffer.seek(0)
    result = Int32RequestParser(10).parse_request(input_buffer, num_bytes)
    if (result is None):
        self.assertEquals(0, input_buffer.tell())
    else:
        self.assertEquals((len(result) + struct.calcsize('!I')), input_buffer.tell())
    return result

dataset/ETHPy150Open scalyr/scalyr-agent-2/scalyr_agent/monitor_utils/tests/server_processors_test.py TestInt32RequestParser.run_test_case/original