def character(self, top, bottom): "Turn two sixteen-bit words into a list representing a bitmap." # organize the bits into columns columns = [ [x for x in bit_iter(top >> 8, 8)][::-1], [x for x in bit_iter(top & 0xff, 8)][::-1], [x for x in bit_iter(bottom >> 8, 8)][::-1], [x for x in bit_iter(bottom & 0xff, 8)][::-1], ] # zip them, to rearrange them into rows. return zip(*columns)
def assertBits(self, given, digits, expected): self.assertEquals(list(bit_iter(given, digits)), expected)