def test_comm(self):
        data = ''.join([chr(x) for x in range(256)])
        data = data + '0d0a0d0a'.decode('hex')
        chunk_size = pyhsm.defines.YSM_MAX_PKT_SIZE - 10 # max size of echo
        count = 0
        while data:
            this = data[:chunk_size]
            data = data[chunk_size:]
            res = self.echo(this)
            for i in xrange(len(this)):
                if res[i] != this[i]:
                    msg = "Echo test failed at position %i (0x%x != 0x%x)" \
                        % (count + i, ord(res[i]), ord(this[i]))
                    raise pyhsm.exception.YHSM_Error(msg)
            count += len(this)

    #
    # Basic commands
    #
Verify that data we send to and receive from the YubiHSM isn't mangled.
dataset/ETHPy150Open Yubico/python-pyhsm/pyhsm/base.py/YHSM.test_comm