当前位置: 首页>>代码示例>>Python>>正文


Python ByteReader.get_left方法代码示例

本文整理汇总了Python中cuwo.bytes.ByteReader.get_left方法的典型用法代码示例。如果您正苦于以下问题:Python ByteReader.get_left方法的具体用法?Python ByteReader.get_left怎么用?Python ByteReader.get_left使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cuwo.bytes.ByteReader的用法示例。


在下文中一共展示了ByteReader.get_left方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_static_entities

# 需要导入模块: from cuwo.bytes import ByteReader [as 别名]
# 或者: from cuwo.bytes.ByteReader import get_left [as 别名]
    def test_static_entities(self):
        with open('./tests/tgen_static.dat', 'rb') as fp:
            data = zlib.decompress(fp.read())

        reader = ByteReader(data)
        source = []
        while reader.get_left() > 0:
            entity = StaticEntityHeader()
            entity.read(reader)
            source.append(entity)

        chunk = tgen.generate(32803, 32803)

        self.assertEqual(len(chunk.static_entities), len(source))

        for index, entity in enumerate(chunk.static_entities):
            header1 = entity.header
            header2 = source[index]
            self.assertEqual(header1.entity_type, header2.entity_type)
            self.assertEqual(header1.pos, header2.pos)
            self.assertEqual(header1.orientation, header2.orientation)
            self.assertEqual(header1.size, header2.size)
            self.assertEqual(header1.closed, header2.closed)
            self.assertEqual(header1.time_offset, header2.time_offset)
            self.assertEqual(header1.something8, header2.something8)
            self.assertEqual(header1.user_id, header2.user_id)
开发者ID:Endimmion,项目名称:cuwo,代码行数:28,代码来源:test_tgen.py

示例2: test_static_entities

# 需要导入模块: from cuwo.bytes import ByteReader [as 别名]
# 或者: from cuwo.bytes.ByteReader import get_left [as 别名]
    def test_static_entities(self):
        with open('./tests/tgen_static.dat', 'rb') as fp:
            data = zlib.decompress(fp.read())

        reader = ByteReader(data)
        source = []
        while reader.get_left() > 0:
            entity = StaticEntityHeader()
            entity.read(reader)
            source.append(entity)

        chunk = tgen.generate(32803, 32803)

        self.assertEqual(len(chunk.static_entities), len(source))

        for index, entity in enumerate(chunk.static_entities):
            header1 = entity.header
            header2 = source[index]
            self.assertEqual(header1.entity_type, header2.entity_type)
            self.assertEqual(header1.pos, header2.pos)
            self.assertEqual(header1.orientation, header2.orientation)
            self.assertEqual(header1.size, header2.size)
            self.assertEqual(header1.closed, header2.closed)
            self.assertEqual(header1.time_offset, header2.time_offset)
            self.assertEqual(header1.something8, header2.something8)
            self.assertEqual(header1.user_id, header2.user_id)

        events = [
            ('generate', (1007, 4974)),
            ('generate', (1007, 4973)),
            ('generate', (1007, 4972)),
            ('generate', (1007, 4971)),
            ('destroy', (1007, 4973)),
            ('generate', (1007, 4970)), 
            ('destroy', (1007, 4972)),
            ('generate', (1007, 4969))
        ]

        chunks = {}

        for (event, chunk) in events:
            if event == 'generate':
                chunks[chunk] = tgen.generate(*chunk)
            elif event == 'destroy':
                chunks[chunk].destroy()
开发者ID:matpow2,项目名称:cuwo,代码行数:47,代码来源:test_tgen.py


注:本文中的cuwo.bytes.ByteReader.get_left方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。