def test_from_stream(self): ae = self.assertEqual data_le = b"\x07\x04\xE1\x9C" data_be = b"\x9C\xE1\x04\x07" stream = ByteIStream(data_le) lcid1 = LCID.from_stream(stream, byte_order=LITTLE_ENDIAN) lcid2 = LCID.from_stream(stream, 0, byte_order=LITTLE_ENDIAN) stream = ByteIStream(data_be) lcid3 = LCID.from_stream(stream, byte_order=BIG_ENDIAN) lcid4 = LCID.from_stream(stream, 0, byte_order=BIG_ENDIAN) ae(lcid1.rsvd, 0x9CE) ae(lcid1.sort_id, 1) ae(lcid1.lang_id, 0x0407) ae(lcid2.rsvd, 0x9CE) ae(lcid2.sort_id, 1) ae(lcid2.lang_id, 0x0407) ae(lcid3.rsvd, 0x9CE) ae(lcid3.sort_id, 1) ae(lcid3.lang_id, 0x0407) ae(lcid4.rsvd, 0x9CE) ae(lcid4.sort_id, 1) ae(lcid4.lang_id, 0x0407)
def test_from_ctype(self): ae = self.assertEqual data = b"\x07\x04\xE1\x9C" lcid = LCID.from_ctype(lcid_le.from_buffer_copy(data)) lcid = LCID.from_ctype(lcid) ae(lcid.rsvd, 0x9CE) ae(lcid.sort_id, 1) ae(lcid.lang_id, 0x0407)
def test_from_stream(self): ae = self.assertEqual stream = ByteIStream(bytes([x for x in range(12)])) cfep1 = ConsoleFEProps.from_stream(stream) cfep2 = ConsoleFEProps.from_stream(stream, 0) ae(cfep1.size, 0x03020100) ae(cfep2.size, 0x03020100) ae(cfep1.sig, 0x07060504) ae(cfep2.sig, 0x07060504) lcid = LCID.from_stream(ByteIStream(b"\x08\x09\x0A\x0B")) ae(cfep1.code_page, lcid) ae(cfep2.code_page, lcid)