

def assertHexEquals(self, expected, actual):
    OKGREEN = '\x1b[92m'
    FAIL = '\x1b[91m'
    ENDC = '\x1b[0m'
    try:
        self.assertEquals(expected, actual)
    except AssertionError:
        line = 0
        cursor = 0
        lines = []
        out = ''
        while ((cursor < len(expected)) or (cursor < len(actual))):
            for a in range(16):
                if ((cursor < len(expected)) and (cursor < len(actual))):
                    if ((expected[cursor] != actual[cursor]) and (line not in exp)):
                        lines.append(line)
                cursor += 1
            line += 1
        exp = ''
        act = ''
        for line in lines:
            exp = ('Expected: %04x: ' % line)
            act = ('Actual  : %04x: ' % line)
            for a in range(16):
                cursor = ((line * 16) + a)
                if ((cursor < len(expected)) and (cursor < len(actual))):
                    if (expected[cursor] != actual[cursor]):
                        exp += ('%s%02x%s' % (OKGREEN, ord(expected[cursor]), ENDC))
                        act += ('%s%02x%s' % (FAIL, ord(actual[cursor]), ENDC))
                    else:
                        exp += ('%02x' % ord(expected[cursor]))
                        act += ('%02x' % ord(actual[cursor]))
                if (((a + 1) % 2) == 0):
                    exp += ' '
                    act += ' '
            out += ('%s- %d \n' % (exp, (line + 1)))
            out += ('%s- %d \n' % (act, (line + 1)))
        print(out)
        raise AssertionError('Hex are not equal')

dataset/ETHPy150Open gutomaia/pyNES/pynes/tests/__init__.py HexTestCase.assertHexEquals/VarMisuse@136/170 `lines`->`exp`