def test_building_init():
    """Test the initialization of Building objects and basic properties."""
    pts_1 = (Point3D(0, 0, 3), Point3D(0, 10,
                                       3), Point3D(10, 10,
                                                   3), Point3D(10, 0, 3))
    pts_2 = (Point3D(10, 0, 3), Point3D(10, 10,
                                        3), Point3D(20, 10,
                                                    3), Point3D(20, 0, 3))
    pts_3 = (Point3D(0, 10, 3), Point3D(0, 20,
                                        3), Point3D(10, 20,
                                                    3), Point3D(10, 10, 3))
    pts_4 = (Point3D(10, 10, 3), Point3D(10, 20,
                                         3), Point3D(20, 20,
                                                     3), Point3D(20, 10, 3))
    room2d_1 = Room2D('Office1', Face3D(pts_1), 3)
    room2d_2 = Room2D('Office2', Face3D(pts_2), 3)
    room2d_3 = Room2D('Office3', Face3D(pts_3), 3)
    room2d_4 = Room2D('Office4', Face3D(pts_4), 3)
    story = Story('Office_Floor', [room2d_1, room2d_2, room2d_3, room2d_4])
    story.solve_room_2d_adjacency(0.01)
    story.set_outdoor_window_parameters(SimpleWindowRatio(0.4))
    story.multiplier = 4
    building = Building('Office_Building_1234', [story])
    building.display_name = 'Office Building'

    str(building)  # test the string representation
    assert building.identifier == 'Office_Building_1234'
    assert building.display_name == 'Office Building'
    assert len(building.unique_stories) == len(
        building.unique_stories_above_ground) == 1
    assert len(building.all_stories()) == 4
    assert len(building.unique_room_2ds) == 4
    assert len(building.all_room_2ds()) == 16
    for story in building.unique_stories:
        assert isinstance(story, Story)
        assert story.has_parent
    for story in building.all_stories():
        assert isinstance(story, Story)
        assert story.has_parent
    for room in building.unique_room_2ds:
        assert isinstance(room, Room2D)
        assert room.has_parent
    for room in building.all_room_2ds():
        assert isinstance(room, Room2D)
        assert room.has_parent
    assert building.height == 15
    assert building.story_count == building.story_count_above_ground == 4
    assert building.height_from_first_floor == building.height_above_ground == 12
    assert building.footprint_area == 100 * 4
    assert building.floor_area == 100 * 4 * 4
    assert building.exterior_wall_area == 60 * 4 * 4
    assert building.exterior_aperture_area == 60 * 4 * 4 * 0.4
    assert building.volume == 100 * 3 * 4 * 4
def test_building_basement():
    """Test the initialization of Building objects and the setting of a basement."""
    pts_1 = (Point3D(0, 0, 3), Point3D(0, 10,
                                       3), Point3D(10, 10,
                                                   3), Point3D(10, 0, 3))
    pts_2 = (Point3D(10, 0, 3), Point3D(10, 10,
                                        3), Point3D(20, 10,
                                                    3), Point3D(20, 0, 3))
    pts_3 = (Point3D(0, 10, 3), Point3D(0, 20,
                                        3), Point3D(10, 20,
                                                    3), Point3D(10, 10, 3))
    pts_4 = (Point3D(10, 10, 3), Point3D(10, 20,
                                         3), Point3D(20, 20,
                                                     3), Point3D(20, 10, 3))
    room2d_1 = Room2D('Office1', Face3D(pts_1), 3)
    room2d_2 = Room2D('Office2', Face3D(pts_2), 3)
    room2d_3 = Room2D('Office3', Face3D(pts_3), 3)
    room2d_4 = Room2D('Office4', Face3D(pts_4), 3)
    story = Story('Office_Floor', [room2d_1, room2d_2, room2d_3, room2d_4])
    story.solve_room_2d_adjacency(0.01)
    story.multiplier = 4
    building = Building('Office_Building_1234', [story])
    building.display_name = 'Office Building'

    building.separate_top_bottom_floors()  # this should yield 3 story objects
    building.unique_stories[0].make_underground(
    )  # make the first floor a basement
    story.set_outdoor_window_parameters(
        SimpleWindowRatio(0.4))  # windows on top floors

    assert not building.unique_stories[0].is_above_ground
    assert building.height == 15
    assert building.story_count == 4
    assert building.story_count_above_ground == 3
    assert building.height_from_first_floor == 12
    assert building.height_above_ground == 9
    assert building.exterior_wall_area == 60 * 4 * 3
            'has failed to import.\n{}'.format(e))

if all_required_inputs(ghenv.Component):
    # duplicate the initial objects
    stories = [story.duplicate() for story in _stories]

    # if there are multipliers, use them to reassign the story multipliers
    if len(multipliers_) != 0:
        assert len(multipliers_) == len(stories), 'Length of input multipliers_ ' \
            '({}) does not match the length of input _stories ({}).'.format(
                len(multipliers_), len(_stories))
        for mult, story in zip(multipliers_, stories):
            story.multiplier = mult

    # generate a default identifier
    if _name_ is None:  # get a default Building name
        display_name = 'Building_{}'.format(document_counter('bldg_count'))
        name = clean_and_id_string(display_name)
    else:
        display_name = _name_
        name = clean_string(display_name)

    # create the Building
    building = Building(name, stories)
    building.display_name = display_name

    # assign the construction set
    if _constr_set_ is not None:
        if isinstance(_constr_set_, str):
            _constr_set_ = construction_set_by_identifier(_constr_set_)
        building.properties.energy.construction_set = _constr_set_