def test_prepare_stage_should_return_none_if_no_init_pos_or_level_is_set(self): init_pos = [-269, 4, 1584] b = BaseBuilder(level_path=None, init_pos=init_pos) ret = b.prepare_stage() self.assertEquals(ret, None) b = BaseBuilder(level_path=None, init_pos=None) b.level = "loaded_level" ret = b.prepare_stage() self.assertEquals(ret, None)
def test_change_block_at_should_change_id_and_data_correctly(Self): bb = BaseBuilder(level_path=None) x, y, z = [1, 2, 3] block_id = 'id' block_data = 'data' bb.level = Mock() bb.level.setBlockAt = Mock() bb.level.setBlockDataAt = Mock() bb.change_block_at(x=x, y=y, z=z, block_id=block_id, block_data=block_data) bb.level.setBlockAt.assert_called_once_with(x, y, z, block_id) bb.level.setBlockDataAt.assert_called_once_with(x, y, z, block_data)
def test_prepare_stage_should_instantiate_box_with_correct_sizes_and_origin(self): init_pos = [1, 2, 3] size = [6, 5, 4] bb = BaseBuilder(level_path=None, init_pos=init_pos, size=size) #mocks customine.base.BoundingBox.return_value.chunkPositions = 'chunk_positions' bb.level = Mock() bb.level.createChunksInBox = Mock() ret_chunks = bb.prepare_stage() self.assertEquals(ret_chunks, 'chunk_positions') customine.base.BoundingBox.assert_called_once_with( origin=tuple(init_pos), size=size )