pack("1", "\0", 0) pack("2", "\0\1", 1) pack("4", "\0\0\0\1", 1) pack("8", "\0\0\0\0\0\0\0\1", 1) pack("f", "\1", 1) pack("m", "\0\1", 1) pack("o", "\0\1", 1) pack("t", "\0\0\0\1", 1) pack("s", "\0\0\0\0\0\0\0\1", 1) pack("$", "\0\0\0\4abcd", "abcd") pack("1248", ("\0" "\0\1" "\0\0\0\1" "\0\0\0\0\0\0\0\1"), 0, 1, 1, 1) pack("fmots", ("\0" "\0\1" "\0\1" "\0\0\0\1" "\0\0\0\0\0\0\0\1"), 0, 1, 1, 1, 1) def test_incr_pack(self): buf = newbuf() buf.packU8(1) buf.packU16(1) buf.packU32(1) buf.packU64(1) self.assertEqual(buf.data(), "\1\0\1\0\0\0\1\0\0\0\0\0\0\0\1") if __name__ == '__main__': test_main()
return [row[Model.COL_PID] for row in model] def __dump_model (self, model, comment = None): # TODO: Provide a command line option to turn this on and off. return if not hasattr (model, "super_model"): # Top model. print "\t(%s)" % ("|".join ([str (i).rjust (2) for i in self.__row_list (model)]),), else: top_model = model.super_model if hasattr (top_model, "super_model"): top_model = top_model.super_model top_indices = self.__row_list (top_model) positions = self.__row_list (model) output = [" "] * len (top_indices) for i, position in enumerate (positions): output[position] = str (i).rjust (2) print "\t(%s)" % ("|".join (output),), if comment is None: print else: print comment if __name__ == "__main__": test_main ()