class TestWallBuilderDecorator(): """ Tests for WallBuilderDecorator """ def __init__(self): """ Default constructor """ self.level = None self.config = None self.decorator = None self.wall_empty = None def setup(self): """ Setup the test case """ self.wall_empty = 1 self.level = (LevelBuilder() .with_size((10, 15)) .with_floor_tile(FLOOR_NATURAL) .with_wall_tile(WALL_NATURAL) .build()) for loc_y in range(2, 8): for loc_x in range(2, 8): wall_tile(self.level, (loc_x, loc_y), self.wall_empty) self.config = WallBuilderDecoratorConfig(['crypt'], {WALL_NATURAL: WALL_CONSTRUCTED}, self.wall_empty) self.decorator = WallBuilderDecorator(self.config) def test_building_walls(self): """ Test that tiles next to empty space are replaced """ self.decorator.decorate_level(self.level) for loc in range(2, 8): assert_that(wall_tile(self.level, (loc, 1)), is_(equal_to(WALL_CONSTRUCTED))) assert_that(wall_tile(self.level, (loc, 8)), is_(equal_to(WALL_CONSTRUCTED))) assert_that(wall_tile(self.level, (1, loc)), is_(equal_to(WALL_CONSTRUCTED))) assert_that(wall_tile(self.level, (8, loc)), is_(equal_to(WALL_CONSTRUCTED))) assert_that(wall_tile(self.level, (0, 0)), is_(equal_to(WALL_NATURAL)))
class TestWallBuilderDecorator(): """ Tests for WallBuilderDecorator """ def __init__(self): """ Default constructor """ self.level = None self.config = None self.decorator = None self.wall_empty = None def setup(self): """ Setup the test case """ self.wall_empty = 1 self.level = Level((10, 15), floor_type = FLOOR_NATURAL, wall_type = WALL_NATURAL) for loc_y in range(2, 8): for loc_x in range(2, 8): self.level.walls[loc_x][loc_y] = self.wall_empty self.config = WallBuilderDecoratorConfig(['crypt'], {WALL_NATURAL: WALL_CONSTRUCTED}, self.wall_empty) self.decorator = WallBuilderDecorator(self.config) def test_building_walls(self): """ Test that tiles next to empty space are replaced """ self.decorator.decorate_level(self.level) for loc in range(2, 8): assert_that(self.level.walls[loc][1], is_(equal_to(WALL_CONSTRUCTED))) assert_that(self.level.walls[loc][8], is_(equal_to(WALL_CONSTRUCTED))) assert_that(self.level.walls[1][loc], is_(equal_to(WALL_CONSTRUCTED))) assert_that(self.level.walls[8][loc], is_(equal_to(WALL_CONSTRUCTED))) assert_that(self.level.walls[0][0], is_(equal_to(WALL_NATURAL)))
def setup(self): """ Setup the test case """ self.wall_empty = 1 self.level = (LevelBuilder().with_size((10, 15)).with_floor_tile( FLOOR_NATURAL).with_wall_tile(WALL_NATURAL).build()) for loc_y in range(2, 8): for loc_x in range(2, 8): wall_tile(self.level, (loc_x, loc_y), self.wall_empty) self.config = WallBuilderDecoratorConfig( ['crypt'], {WALL_NATURAL: WALL_CONSTRUCTED}, self.wall_empty) self.decorator = WallBuilderDecorator(self.config)
class TestWallBuilderDecorator(): """ Tests for WallBuilderDecorator """ def __init__(self): """ Default constructor """ self.level = None self.config = None self.decorator = None self.wall_empty = None def setup(self): """ Setup the test case """ self.wall_empty = 1 self.level = (LevelBuilder().with_size((10, 15)).with_floor_tile( FLOOR_NATURAL).with_wall_tile(WALL_NATURAL).build()) for loc_y in range(2, 8): for loc_x in range(2, 8): wall_tile(self.level, (loc_x, loc_y), self.wall_empty) self.config = WallBuilderDecoratorConfig( ['crypt'], {WALL_NATURAL: WALL_CONSTRUCTED}, self.wall_empty) self.decorator = WallBuilderDecorator(self.config) def test_building_walls(self): """ Test that tiles next to empty space are replaced """ self.decorator.decorate_level(self.level) for loc in range(2, 8): assert_that(wall_tile(self.level, (loc, 1)), is_(equal_to(WALL_CONSTRUCTED))) assert_that(wall_tile(self.level, (loc, 8)), is_(equal_to(WALL_CONSTRUCTED))) assert_that(wall_tile(self.level, (1, loc)), is_(equal_to(WALL_CONSTRUCTED))) assert_that(wall_tile(self.level, (8, loc)), is_(equal_to(WALL_CONSTRUCTED))) assert_that(wall_tile(self.level, (0, 0)), is_(equal_to(WALL_NATURAL)))
def setup(self): """ Setup the test case """ self.wall_empty = 1 self.level = Level((10, 15), floor_type = FLOOR_NATURAL, wall_type = WALL_NATURAL) for loc_y in range(2, 8): for loc_x in range(2, 8): self.level.walls[loc_x][loc_y] = self.wall_empty self.config = WallBuilderDecoratorConfig(['crypt'], {WALL_NATURAL: WALL_CONSTRUCTED}, self.wall_empty) self.decorator = WallBuilderDecorator(self.config)
def setup(self): """ Setup the test case """ self.wall_empty = 1 self.level = (LevelBuilder() .with_size((10, 15)) .with_floor_tile(FLOOR_NATURAL) .with_wall_tile(WALL_NATURAL) .build()) for loc_y in range(2, 8): for loc_x in range(2, 8): wall_tile(self.level, (loc_x, loc_y), self.wall_empty) self.config = WallBuilderDecoratorConfig(['crypt'], {WALL_NATURAL: WALL_CONSTRUCTED}, self.wall_empty) self.decorator = WallBuilderDecorator(self.config)