示例#1
0
    def test_can_place_building_Returns_false_if_building_is_nearby(self):
        player = Player()
        vertex = Vertex(id=0)
        neighbour_vertex = Vertex(id=1)
        edge = Edge(id=0)

        vertex.edges = [edge]
        neighbour_vertex.edges = [edge]
        neighbour_vertex.building = Settlement(player=player)
        edge.vertices = [vertex, neighbour_vertex]
        edge.road = Road(player=player)

        assert not vertex.can_place_building(player=player)
示例#2
0
 def test_assign_building_raises_error_if_already_assigned(self):
     vertex = Vertex(id=0)
     vertex.building = Building()
     with pytest.raises(RuntimeError,
                        match=r"A building already exists at this vertex"):
         vertex.assign_building(building=Building())