def deserialize(self, bit_stream: BitStream): if not bit_stream.read_start(): return self.object_class = bit_stream.read_int() self.object_type = bit_stream.read_int() self.server = bit_stream.read_int() self.object_number = bit_stream.read_long()
def test_read_write_primitive(self): int_values = [-32769, -32768, -128, -127, -8, -7, 0, 7, 8, 127, 128, 32768, 32769] bit_stream = BitStream() for i in int_values: bit_stream.write_int(i) bit_stream.write_long(i) bit_stream.write_str(str(i)) bit_stream.cursor = 0 for i in int_values: self.assertEqual(bit_stream.read_int(), i) self.assertEqual(bit_stream.read_long(), i) self.assertEqual(bit_stream.read_str(), str(i))