def test_run(self, ifc, collector, drawing): drawing.show_decorations().should_be_called() drawing.get_drawing_target_view( "drawing").should_be_called().will_return("target_view") drawing.get_annotation_context( "target_view").should_be_called().will_return("context") drawing.create_annotation_object( "object_type").should_be_called().will_return("obj") ifc.get_entity("obj").should_be_called().will_return(None) drawing.get_ifc_representation_class("object_type").should_be_called( ).will_return("ifc_representation_class") drawing.run_root_assign_class( obj="obj", ifc_class="IfcAnnotation", predefined_type="object_type", should_add_representation=True, context="context", ifc_representation_class="ifc_representation_class", ).should_be_called().will_return("element") drawing.get_drawing_group("drawing").should_be_called().will_return( "group") ifc.run("group.assign_group", group="group", product="element").should_be_called() collector.assign("obj").should_be_called() drawing.enable_editing("obj").should_be_called() subject.add_annotation(ifc, collector, drawing, drawing="drawing", object_type="object_type")
def test_creating_a_new_body_if_there_is_a_parametric_material_usage( self, ifc, type): ifc.run("type.assign_type", related_object="element", relating_type="type").should_be_called() type.has_material_usage("element").should_be_called().will_return(True) type.get_body_representation("element").should_be_called().will_return( None) type.get_body_context().should_be_called().will_return("context") type.get_ifc_representation_class( "element").should_be_called().will_return("class") type.get_profile_set_usage("element").should_be_called().will_return( "usage") type.run_geometry_add_representation( obj="obj", context="context", ifc_representation_class="class", profile_set_usage="usage").should_be_called().will_return( "mapped_rep") ifc.get_object("element").should_be_called().will_return("obj") type.has_dynamic_voids("obj").should_be_called().will_return(False) type.run_geometry_switch_representation( obj="obj", representation="mapped_rep", should_reload=True, enable_dynamic_voids=False, is_global=False).should_be_called() type.disable_editing("obj").should_be_called() subject.assign_type(ifc, type, element="element", type="type")
def test_copy_with_new_geometry_added_afresh_for_speed( self, ifc, collector, geometry, root): ifc.get_entity("obj").should_be_called().will_return( "original_element") ifc.run("root.copy_class", product="original_element").should_be_called().will_return( "element") ifc.link("element", "obj").should_be_called() root.get_element_type("element").should_be_called().will_return("type") root.does_type_have_representations( "type").should_be_called().will_return(False) root.get_object_representation("obj").should_be_called().will_return( "representation") root.get_representation_context( "representation").should_be_called().will_return("context") geometry.get_ifc_representation_class( "element", "representation").should_be_called().will_return( "ifc_representation_class") geometry.get_profile_set_usage( "element").should_be_called().will_return("profile_set_usage") root.run_geometry_add_representation( obj="obj", context="context", ifc_representation_class="ifc_representation_class", profile_set_usage="profile_set_usage", ).should_be_called() collector.assign("obj").should_be_called() root.is_opening_element("element").should_be_called().will_return( False) subject.copy_class(ifc, collector, geometry, root, obj="obj")
def test_run(self, ifc, system): system.get_ports("element").should_be_called().will_return(["port"]) system.load_ports(["port"]).should_be_called() system.create_empty_at_cursor_with_element_orientation("element").should_be_called().will_return("obj") system.run_root_assign_class(obj="obj", ifc_class="IfcDistributionPort").should_be_called().will_return("port") ifc.run("system.assign_port", element="element", port="port").should_be_called() subject.add_port(ifc, system, element="element")
def test_not_adding_a_representation_if_requested(self, ifc, collector, root): ifc.get_entity("obj").should_be_called().will_return(None) root.get_object_name("obj").should_be_called().will_return("name") ifc.run("root.create_entity", ifc_class="ifc_class", predefined_type="predefined_type", name="name").should_be_called().will_return("element") root.set_object_name("obj", "element").should_be_called() ifc.link("element", "obj").should_be_called() root.set_element_specific_display_settings( "obj", "element").should_be_called() collector.sync("obj").should_be_called() collector.assign("obj").should_be_called() subject.assign_class( ifc, collector, root, obj="obj", ifc_class="ifc_class", predefined_type="predefined_type", should_add_representation=False, context="context", ifc_representation_class="ifc_representation_class", )
def test_assign_a_class_with_geometry_and_autodetected_spatial_container( self, ifc, collector, root): ifc.get_entity("obj").should_be_called().will_return(None) root.get_object_name("obj").should_be_called().will_return("name") ifc.run("root.create_entity", ifc_class="ifc_class", predefined_type="predefined_type", name="name").should_be_called().will_return("element") root.set_object_name("obj", "element").should_be_called() ifc.link("element", "obj").should_be_called() root.run_geometry_add_representation( obj="obj", context="context", ifc_representation_class="ifc_representation_class", profile_set_usage=None).should_be_called() root.set_element_specific_display_settings( "obj", "element").should_be_called() collector.sync("obj").should_be_called() collector.assign("obj").should_be_called() subject.assign_class( ifc, collector, root, obj="obj", ifc_class="ifc_class", predefined_type="predefined_type", should_add_representation=True, context="context", ifc_representation_class="ifc_representation_class", )
def test_run(self, ifc, owner): owner.get_user().should_be_called().will_return("user") ifc.run("owner.remove_person_and_organisation", person_and_organisation="person_and_organisation" ).should_be_called() subject.remove_person_and_organisation( ifc, owner, person_and_organisation="person_and_organisation")
def predict(self, ifc, geometry, surveyor): ifc.get_entity("obj").should_be_called().will_return("element") geometry.clear_cache("element").should_be_called() geometry.clear_scale("obj").should_be_called() surveyor.get_absolute_matrix("obj").should_be_called().will_return("matrix") ifc.run("geometry.edit_object_placement", product="element", matrix="matrix").should_be_called() geometry.record_object_position("obj").should_be_called()
def test_run(self, ifc, unit): unit.get_si_name_from_unit_type( "unit_type").should_be_called().will_return("name") ifc.run("unit.add_si_unit", unit_type="unit_type", name="name").should_be_called().will_return("unit") unit.import_units().should_be_called() assert subject.add_si_unit(ifc, unit, unit_type="unit_type") == "unit"
def test_run(self, ifc, owner): owner.export_role_attributes().should_be_called().will_return( "attributes") owner.get_role().should_be_called().will_return("role") ifc.run("owner.edit_role", role="role", attributes="attributes").should_be_called() owner.clear_role().should_be_called() subject.edit_role(ifc, owner)
def test_run(self, ifc): ifc.run("owner.add_person_and_organisation", person="person", organisation="organisation").should_be_called().will_return( "person_and_organisation") assert (subject.add_person_and_organisation( ifc, person="person", organisation="organisation") == "person_and_organisation")
def test_run(self, ifc, owner): owner.get_actor().should_be_called().will_return("actor") owner.export_actor_attributes().should_be_called().will_return( "attributes") ifc.run("owner.edit_actor", actor="actor", attributes="attributes").should_be_called() owner.clear_actor().should_be_called() subject.edit_actor(ifc, owner)
def test_clearing_the_active_user_if_you_remove_it(self, ifc, owner): owner.get_user().should_be_called().will_return("user") owner.clear_user().should_be_called() ifc.run("owner.remove_person_and_organisation", person_and_organisation="user").should_be_called() subject.remove_person_and_organisation(ifc, owner, person_and_organisation="user")
def test_run(self, ifc): ifc.get_entity("obj").should_be_called().will_return("product") ifc.run("library.unassign_reference", product="product", reference="reference").should_be_called() subject.unassign_library_reference(ifc, obj="obj", reference="reference")
def test_run(self, ifc, owner): owner.get_person().should_be_called().will_return("person") owner.export_person_attributes().should_be_called().will_return( "attributes") ifc.run("owner.edit_person", person="person", attributes="attributes").should_be_called() owner.clear_person().should_be_called() subject.edit_person(ifc, owner)
def test_run(self, ifc): ifc.run("owner.add_address", assigned_object="parent", ifc_class="IfcPostalAddress").should_be_called().will_return( "address") assert subject.add_address(ifc, parent="parent", ifc_class="IfcPostalAddress") == "address"
def test_removing_an_unused_mapped_representation(self, ifc, geometry): ifc.get_entity("obj").should_be_called().will_return("element") geometry.is_mapped_representation("mapped_rep").should_be_called().will_return(True) geometry.get_element_type("element").should_be_called().will_return("type") geometry.resolve_mapped_representation("mapped_rep").should_be_called().will_return("representation") geometry.get_representation_data("representation").should_be_called().will_return(None) ifc.run("geometry.unassign_representation", product="type", representation="representation").should_be_called() ifc.run("geometry.remove_representation", representation="representation").should_be_called() subject.remove_representation(ifc, geometry, obj="obj", representation="mapped_rep")
def test_run(self, ifc, unit): ifc.run("unit.add_context_dependent_unit", unit_type="unit_type", name="name").should_be_called().will_return("unit") unit.import_units().should_be_called() assert subject.add_context_dependent_unit(ifc, unit, unit_type="unit_type", name="name") == "unit"
def test_run(self, ifc, style): style.get_style("obj").should_be_called().will_return("style") style.export_surface_attributes("obj").should_be_called().will_return( "attributes") ifc.run("style.edit_presentation_style", style="style", attributes="attributes").should_be_called() style.disable_editing("obj").should_be_called() subject.edit_style(ifc, style, obj="obj")
def test_run(self, ifc, context): context.get_context().should_be_called().will_return("context") context.export_attributes().should_be_called().will_return( "attributes") ifc.run("context.edit_context", context="context", attributes="attributes").should_be_called() context.clear_context().should_be_called() subject.edit_context(ifc, context)
def test_run(self, ifc, library): library.set_editing_mode("REFERENCES").should_be_called() library.get_active_library().should_be_called().will_return("library") library.export_library_attributes().should_be_called().will_return( "attributes") ifc.run("library.edit_library", library="library", attributes="attributes").should_be_called() library.import_references("library").should_be_called() subject.edit_library(ifc, library)
def test_run(self, ifc, drawing): drawing.get_text_literal("obj").should_be_called().will_return("text") drawing.export_text_literal_attributes( "obj").should_be_called().will_return("attributes") ifc.run("drawing.edit_text_literal", text_literal="text", attributes="attributes").should_be_called() drawing.update_text_value("obj").should_be_called() drawing.disable_editing_text("obj").should_be_called() subject.edit_text(ifc, drawing, obj="obj")
def test_editing_named_units(self, ifc, unit): unit.export_unit_attributes().should_be_called().will_return( "attributes") unit.get_unit_class("unit").should_be_called().will_return( "IfcNamedUnit") ifc.run("unit.edit_named_unit", unit="unit", attributes="attributes").should_be_called() unit.import_units().should_be_called() unit.clear_active_unit().should_be_called() subject.edit_unit(ifc, unit, unit="unit")
def test_run(self, ifc, collector): ifc.get_entity("related_obj").should_be_called().will_return( "related_object") ifc.run("aggregate.unassign_object", product="related_object").should_be_called().will_return("rel") collector.assign("relating_obj").should_be_called() collector.assign("related_obj").should_be_called() assert subject.unassign_object(ifc, collector, relating_obj="relating_obj", related_obj="related_obj") == "rel"
def test_adding_a_context(self, ifc): ifc.run("context.add_context", context_type="Model", context_identifier=None, target_view=None, parent=None).should_be_called().will_return("context") assert (subject.add_context(ifc, context_type="Model", context_identifier=None, target_view=None, parent=None) == "context")
def test_run(self, ifc, brick): brick.get_library_brick_reference( "library", "brick_uri").should_be_called().will_return("reference") ifc.run("library.remove_reference", reference="reference").should_be_called() brick.remove_brick("brick_uri").should_be_called() brick.run_refresh_brick_viewer().should_be_called() subject.remove_brick(ifc, brick, library="library", brick_uri="brick_uri")
def test_removing_an_actively_used_representation(self, ifc, geometry): ifc.get_entity("obj").should_be_called().will_return("element") geometry.is_mapped_representation("representation").should_be_called().will_return(False) geometry.is_type_product("element").should_be_called().will_return(False) geometry.get_representation_data("representation").should_be_called().will_return("data") geometry.has_data_users("data").should_be_called().will_return(True) geometry.replace_object_with_empty("obj").should_be_called() ifc.run( "geometry.unassign_representation", product="element", representation="representation" ).should_be_called() ifc.run("geometry.remove_representation", representation="representation").should_be_called() subject.remove_representation(ifc, geometry, obj="obj", representation="representation")
def test_assigning_and_not_changing_data_if_the_type_has_no_data( self, ifc, type): ifc.run("type.assign_type", related_object="element", relating_type="type").should_be_called() type.has_material_usage("element").should_be_called().will_return( False) ifc.get_object("type").should_be_called().will_return("type_obj") type.get_object_data("type_obj").should_be_called().will_return(None) ifc.get_object("element").should_be_called().will_return("obj") type.disable_editing("obj").should_be_called() subject.assign_type(ifc, type, element="element", type="type")
def test_run(self, ifc, drawing): drawing.get_drawing_collection( "drawing").should_be_called().will_return("collection") drawing.get_drawing_group("drawing").should_be_called().will_return( "group") drawing.get_group_elements("group").should_be_called().will_return( "elements") drawing.delete_drawing_elements("elements").should_be_called() ifc.run("group.remove_group", group="group").should_be_called() drawing.delete_collection("collection").should_be_called() ifc.run("root.remove_product", product="drawing").should_be_called() drawing.import_drawings().should_be_called() subject.remove_drawing(ifc, drawing, drawing="drawing")
def test_run(self, ifc, drawing): ifc.get_entity("obj").should_be_called().will_return("element") drawing.get_text_product("element").should_be_called().will_return( "existing_product") ifc.run("drawing.unassign_product", relating_product="existing_product", related_object="element").should_be_called() ifc.run("drawing.assign_product", relating_product="product", related_object="element").should_be_called() drawing.update_text_value("obj").should_be_called() drawing.disable_editing_text_product("obj").should_be_called() subject.edit_text_product(ifc, drawing, obj="obj", product="product")