Exemplo n.º 1
0
    def test_deploy_monsters(self):
        game = Game()
        game.populate_map()
        game.deploy_monsters(10)

        total_occupants = 0
        for city in game.cities:
            total_occupants += len(city.occupants)

        assert_that(total_occupants, is_(10))
Exemplo n.º 2
0
    def test_populate_map(self):
        game = Game()
        game.populate_map()

        assert_that(len(game.cities), is_(7))
        assert_that(len(game.city_index), is_(7))

        first_city = game.cities[0]
        assert_that(first_city.west, is_(instance_of(Game.City)))
        assert_that(first_city.east.name, is_(first_city.refs['east']))
Exemplo n.º 3
0
    def test_city_destroy(self):
        game = Game()
        game.populate_map()

        city = game.cities[0]
        game.monsters.append(Game.Monster(1, city))
        game.monsters.append(Game.Monster(2, city))

        game.destroy_city(city)

        assert_that(len(game.monsters), is_(0))
        assert_that(city, is_not_in(game.cities))
        assert_that(city.name, is_not_in(game.city_index.keys()))