Example #1
0
File: _test.py Project: tali/PyMK
    def _test_write(self, hexstr, data, start_addr, write_start_addr=True):
        # prepare
        ih = IntelHex(None)
        ih._buf = data
        ih.start_addr = start_addr
        # write
        sio = StringIO()
        self.assertTrue(ih.writefile(sio, write_start_addr))
        s = sio.getvalue()
        sio.close()
        # check
        self.assertEquals(
            hexstr,
            s,
            """Written data is incorrect
Should be:
%s

Written:
%s
"""
            % (hexstr, s),
        )