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


Python Layer.getChunk方法代码示例

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


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

示例1: LayerTestCase

# 需要导入模块: from layer import Layer [as 别名]
# 或者: from layer.Layer import getChunk [as 别名]
class LayerTestCase(unittest.TestCase):
    """
    Layer: Implements a layer of minecraft blocks.
    - Constructor should work with no arguments
    - getChunk() should return a valid chunk.
    - getChunk() should fail on bad inputs.
    
    Depends on chunk unit tests.
    """
    testobject = None # this gets set in setUp, and tested in the subsequent tests. This allows subclassing of the tested object!
    
    def setUp(self):
        self.testobject = self.construct(Layer)
        
    def construct(self, thisclass):
        """
        self.construct: the solution to re-testing the superclasses' constructor. Usually we test the class's constructor in setUp,
        but this way we leave a nice hook to override setUp as needed, and to allow the subclass to call the constructor using 
        the superclass's test.
        
        Don't call the superclass's construct() method if you're changing the rules for constructing.
        """
        return thisclass()
    
    def test_getchunk(self):
        self.testobject = Layer()
        random.seed()
        chunk = self.testobject.getChunk(random.randint(-sys.maxint-1, sys.maxint - 1),random.randint(-sys.maxint -1, sys.maxint - 1))
        self.assertEquals(type(chunk), Chunk)
        validate_chunk_fields(chunk)
        
        try:
            self.testobject.getChunk(None, False)
        except Exception as e:
            pass
        else:
            self.fail("filter getChunk should fail on bad input ")
开发者ID:AnkurSheel,项目名称:pymcworldgen,代码行数:39,代码来源:test_baseclasses.py


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