Replace all ifcopenshell.api.run with ifcopenshell.api static functions.

This commit is contained in:
Dion Moult
2024-06-28 12:36:31 +10:00
parent b5d613989e
commit 07060fc769
432 changed files with 4633 additions and 4856 deletions
@@ -17,17 +17,18 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import test.bootstrap
import ifcopenshell.api
import ifcopenshell.api.root
import ifcopenshell.api.system
import ifcopenshell.util.system
class TestAddPort(test.bootstrap.IFC4):
def test_run(self):
assert ifcopenshell.api.run("system.add_port", self.file).is_a("IfcDistributionPort")
assert ifcopenshell.api.system.add_port(self.file).is_a("IfcDistributionPort")
def test_assigning_a_port_as_well_if_an_element_is_specified(self):
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcFlowTerminal")
port = ifcopenshell.api.run("system.add_port", self.file, element=element)
element = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcFlowTerminal")
port = ifcopenshell.api.system.add_port(self.file, element=element)
assert ifcopenshell.util.system.get_ports(element) == [port]
@@ -17,13 +17,13 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import test.bootstrap
import ifcopenshell.api
import ifcopenshell.api.system
class TestAddSystem(test.bootstrap.IFC4):
def test_adding_a_system(self):
system = ifcopenshell.api.run("system.add_system", self.file, ifc_class="IfcSystem")
system2 = ifcopenshell.api.run("system.add_system", self.file, ifc_class="IfcDistributionSystem")
system = ifcopenshell.api.system.add_system(self.file, ifc_class="IfcSystem")
system2 = ifcopenshell.api.system.add_system(self.file, ifc_class="IfcDistributionSystem")
assert system.is_a("IfcSystem")
if self.file.schema == "IFC2X3":
assert system2.is_a("IfcSystem")
@@ -17,7 +17,7 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import test.bootstrap
import ifcopenshell.api
import ifcopenshell.api.system
class TestAssignFlowControl(test.bootstrap.IFC4):
@@ -26,8 +26,7 @@ class TestAssignFlowControl(test.bootstrap.IFC4):
flow_control = self.file.create_entity("IfcDistributionControlElement")
# simple assignment
relation = ifcopenshell.api.run(
"system.assign_flow_control",
relation = ifcopenshell.api.system.assign_flow_control(
self.file,
related_flow_control=flow_control,
relating_flow_element=flow_element,
@@ -37,8 +36,7 @@ class TestAssignFlowControl(test.bootstrap.IFC4):
assert relation.RelatedControlElements == (flow_control,)
# trying to establish existing relationship
relation0 = ifcopenshell.api.run(
"system.assign_flow_control",
relation0 = ifcopenshell.api.system.assign_flow_control(
self.file,
related_flow_control=flow_control,
relating_flow_element=flow_element,
@@ -47,8 +45,7 @@ class TestAssignFlowControl(test.bootstrap.IFC4):
# assigning same control to another object
flow_element1 = self.file.createIfcFlowSegment()
relation = ifcopenshell.api.run(
"system.assign_flow_control",
relation = ifcopenshell.api.system.assign_flow_control(
self.file,
related_flow_control=flow_control,
relating_flow_element=flow_element1,
@@ -57,8 +54,7 @@ class TestAssignFlowControl(test.bootstrap.IFC4):
# assigning another control to the same object
flow_control1 = self.file.create_entity("IfcDistributionControlElement")
relation = ifcopenshell.api.run(
"system.assign_flow_control",
relation = ifcopenshell.api.system.assign_flow_control(
self.file,
related_flow_control=flow_control1,
relating_flow_element=flow_element,
@@ -18,7 +18,10 @@
import numpy
import test.bootstrap
import ifcopenshell.api
import ifcopenshell.api.unit
import ifcopenshell.api.root
import ifcopenshell.api.system
import ifcopenshell.api.geometry
import ifcopenshell.util.placement
import ifcopenshell.util.system
@@ -26,22 +29,22 @@ import ifcopenshell.util.system
class TestAssignPort(test.bootstrap.IFC4):
def test_assigning_a_port_once_only(self):
port = self.file.createIfcDistributionPort()
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcFlowSegment")
ifcopenshell.api.run("system.assign_port", self.file, element=element, port=port)
element = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcFlowSegment")
ifcopenshell.api.system.assign_port(self.file, element=element, port=port)
ifc2x3 = self.file.schema == "IFC2X3"
if ifc2x3:
assert element.HasPorts[0].RelatingPort == port
else:
assert element.IsNestedBy[0].RelatedObjects == (port,)
assert ifcopenshell.util.system.get_ports(element) == [port]
ifcopenshell.api.run("system.assign_port", self.file, element=element, port=port)
ifcopenshell.api.system.assign_port(self.file, element=element, port=port)
assert ifcopenshell.util.system.get_ports(element) == [port]
def test_updating_the_placement_to_be_relative_if_it_exists(self):
ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcProject")
ifcopenshell.api.run("unit.assign_unit", self.file)
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcFlowSegment")
subelement = ifcopenshell.api.run("system.add_port", self.file)
ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcProject")
ifcopenshell.api.unit.assign_unit(self.file)
element = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcFlowSegment")
subelement = ifcopenshell.api.system.add_port(self.file)
matrix = numpy.array(
(
(1.0, 0.0, 0.0, 1.0),
@@ -58,13 +61,13 @@ class TestAssignPort(test.bootstrap.IFC4):
(0.0, 0.0, 0.0, 1.0),
)
)
ifcopenshell.api.run(
"geometry.edit_object_placement", self.file, product=element, matrix=matrix.copy(), is_si=False
ifcopenshell.api.geometry.edit_object_placement(
self.file, product=element, matrix=matrix.copy(), is_si=False
)
ifcopenshell.api.run(
"geometry.edit_object_placement", self.file, product=subelement, matrix=submatrix.copy(), is_si=False
ifcopenshell.api.geometry.edit_object_placement(
self.file, product=subelement, matrix=submatrix.copy(), is_si=False
)
ifcopenshell.api.run("system.assign_port", self.file, element=element, port=subelement)
ifcopenshell.api.system.assign_port(self.file, element=element, port=subelement)
assert numpy.array_equal(ifcopenshell.util.placement.get_local_placement(element.ObjectPlacement), matrix)
assert numpy.array_equal(ifcopenshell.util.placement.get_local_placement(subelement.ObjectPlacement), submatrix)
assert subelement.ObjectPlacement.PlacementRelTo == element.ObjectPlacement
@@ -18,27 +18,28 @@
import pytest
import test.bootstrap
import ifcopenshell.api
import ifcopenshell.api.root
import ifcopenshell.api.system
import ifcopenshell.util.system
class TestAssignSystem(test.bootstrap.IFC4):
def test_assign_system(self):
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcFlowSegment")
element2 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcFlowSegment")
system = ifcopenshell.api.run("system.add_system", self.file)
ifcopenshell.api.run("system.assign_system", self.file, products=[element, element2], system=system)
element = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcFlowSegment")
element2 = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcFlowSegment")
system = ifcopenshell.api.system.add_system(self.file)
ifcopenshell.api.system.assign_system(self.file, products=[element, element2], system=system)
assert len(self.file.by_type("IfcRelAssignsToGroup")) == 1
assert set(ifcopenshell.util.system.get_system_elements(system)) == set(self.file.by_type("IfcFlowSegment"))
def test_exception_on_unassignable_elements(self):
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcFlowSegment")
element = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcFlowSegment")
proj = self.file.createIfcProject()
system = ifcopenshell.api.run("system.add_system", self.file)
system = ifcopenshell.api.system.add_system(self.file)
with pytest.raises(TypeError):
ifcopenshell.api.run("system.assign_system", self.file, products=[element, proj], system=system)
ifcopenshell.api.system.assign_system(self.file, products=[element, proj], system=system)
with pytest.raises(TypeError):
ifcopenshell.api.run("system.assign_system", self.file, products=[element], system=proj)
ifcopenshell.api.system.assign_system(self.file, products=[element], system=proj)
class TestAssignSystemIFC2X3(test.bootstrap.IFC2X3, TestAssignSystem):
@@ -17,15 +17,16 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import test.bootstrap
import ifcopenshell.api
import ifcopenshell.api.root
import ifcopenshell.api.system
import ifcopenshell.util.system
class TestConnectPort(test.bootstrap.IFC4):
def test_connecting_a_port(self):
port = ifcopenshell.api.run("system.add_port", self.file)
port2 = ifcopenshell.api.run("system.add_port", self.file)
ifcopenshell.api.run("system.connect_port", self.file, port1=port, port2=port2)
port = ifcopenshell.api.system.add_port(self.file)
port2 = ifcopenshell.api.system.add_port(self.file)
ifcopenshell.api.system.connect_port(self.file, port1=port, port2=port2)
assert port.ConnectedTo[0].RelatedPort == port2
assert port2.ConnectedFrom[0].RelatingPort == port
assert port2.ConnectedTo[0].RelatedPort == port
@@ -35,11 +36,11 @@ class TestConnectPort(test.bootstrap.IFC4):
assert len(self.file.by_type("IfcRelConnectsPorts")) == 2
def test_not_connecting_a_port_twice(self):
port = ifcopenshell.api.run("system.add_port", self.file)
port2 = ifcopenshell.api.run("system.add_port", self.file)
ifcopenshell.api.run("system.connect_port", self.file, port1=port, port2=port2)
ifcopenshell.api.run("system.connect_port", self.file, port1=port, port2=port2)
ifcopenshell.api.run("system.connect_port", self.file, port1=port2, port2=port)
port = ifcopenshell.api.system.add_port(self.file)
port2 = ifcopenshell.api.system.add_port(self.file)
ifcopenshell.api.system.connect_port(self.file, port1=port, port2=port2)
ifcopenshell.api.system.connect_port(self.file, port1=port, port2=port2)
ifcopenshell.api.system.connect_port(self.file, port1=port2, port2=port)
assert port.ConnectedTo[0].RelatedPort == port2
assert port2.ConnectedFrom[0].RelatingPort == port
assert port2.ConnectedTo[0].RelatedPort == port
@@ -49,9 +50,9 @@ class TestConnectPort(test.bootstrap.IFC4):
assert len(self.file.by_type("IfcRelConnectsPorts")) == 2
def test_connecting_a_port_from_source_to_sink(self):
port = ifcopenshell.api.run("system.add_port", self.file)
port2 = ifcopenshell.api.run("system.add_port", self.file)
ifcopenshell.api.run("system.connect_port", self.file, port1=port, port2=port2, direction="SOURCE")
port = ifcopenshell.api.system.add_port(self.file)
port2 = ifcopenshell.api.system.add_port(self.file)
ifcopenshell.api.system.connect_port(self.file, port1=port, port2=port2, direction="SOURCE")
assert port.ConnectedTo[0].RelatedPort == port2
assert port2.ConnectedFrom[0].RelatingPort == port
assert port.FlowDirection == "SOURCE"
@@ -59,9 +60,9 @@ class TestConnectPort(test.bootstrap.IFC4):
assert len(self.file.by_type("IfcRelConnectsPorts")) == 1
def test_connecting_a_port_from_sink_to_source(self):
port = ifcopenshell.api.run("system.add_port", self.file)
port2 = ifcopenshell.api.run("system.add_port", self.file)
ifcopenshell.api.run("system.connect_port", self.file, port1=port, port2=port2, direction="SINK")
port = ifcopenshell.api.system.add_port(self.file)
port2 = ifcopenshell.api.system.add_port(self.file)
ifcopenshell.api.system.connect_port(self.file, port1=port, port2=port2, direction="SINK")
assert port2.ConnectedTo[0].RelatedPort == port
assert port.ConnectedFrom[0].RelatingPort == port2
assert port.FlowDirection == "SINK"
@@ -69,9 +70,9 @@ class TestConnectPort(test.bootstrap.IFC4):
assert len(self.file.by_type("IfcRelConnectsPorts")) == 1
def test_connecting_a_port_as_both_source_and_sink(self):
port = ifcopenshell.api.run("system.add_port", self.file)
port2 = ifcopenshell.api.run("system.add_port", self.file)
ifcopenshell.api.run("system.connect_port", self.file, port1=port, port2=port2, direction="SOURCEANDSINK")
port = ifcopenshell.api.system.add_port(self.file)
port2 = ifcopenshell.api.system.add_port(self.file)
ifcopenshell.api.system.connect_port(self.file, port1=port, port2=port2, direction="SOURCEANDSINK")
assert port.ConnectedTo[0].RelatedPort == port2
assert port2.ConnectedFrom[0].RelatingPort == port
assert port2.ConnectedTo[0].RelatedPort == port
@@ -81,11 +82,11 @@ class TestConnectPort(test.bootstrap.IFC4):
assert len(self.file.by_type("IfcRelConnectsPorts")) == 2
def test_ports_can_only_connect_to_one_port_at_a_time(self):
port = ifcopenshell.api.run("system.add_port", self.file)
port2 = ifcopenshell.api.run("system.add_port", self.file)
port3 = ifcopenshell.api.run("system.add_port", self.file)
ifcopenshell.api.run("system.connect_port", self.file, port1=port, port2=port3, direction="SOURCEANDSINK")
ifcopenshell.api.run("system.connect_port", self.file, port1=port, port2=port2, direction="SOURCE")
port = ifcopenshell.api.system.add_port(self.file)
port2 = ifcopenshell.api.system.add_port(self.file)
port3 = ifcopenshell.api.system.add_port(self.file)
ifcopenshell.api.system.connect_port(self.file, port1=port, port2=port3, direction="SOURCEANDSINK")
ifcopenshell.api.system.connect_port(self.file, port1=port, port2=port2, direction="SOURCE")
assert port.ConnectedTo[0].RelatedPort == port2
assert port2.ConnectedFrom[0].RelatingPort == port
assert port.FlowDirection == "SOURCE"
@@ -95,10 +96,10 @@ class TestConnectPort(test.bootstrap.IFC4):
assert not port3.ConnectedFrom
def test_changing_a_port_from_source_and_sink_to_only_source(self):
port = ifcopenshell.api.run("system.add_port", self.file)
port2 = ifcopenshell.api.run("system.add_port", self.file)
ifcopenshell.api.run("system.connect_port", self.file, port1=port, port2=port2, direction="SOURCEANDSINK")
ifcopenshell.api.run("system.connect_port", self.file, port1=port, port2=port2, direction="SOURCE")
port = ifcopenshell.api.system.add_port(self.file)
port2 = ifcopenshell.api.system.add_port(self.file)
ifcopenshell.api.system.connect_port(self.file, port1=port, port2=port2, direction="SOURCEANDSINK")
ifcopenshell.api.system.connect_port(self.file, port1=port, port2=port2, direction="SOURCE")
assert port.ConnectedTo[0].RelatedPort == port2
assert port2.ConnectedFrom[0].RelatingPort == port
assert port.FlowDirection == "SOURCE"
@@ -106,12 +107,12 @@ class TestConnectPort(test.bootstrap.IFC4):
assert len(self.file.by_type("IfcRelConnectsPorts")) == 1
def test_connecting_ports_with_a_realising_element(self):
port = ifcopenshell.api.run("system.add_port", self.file)
port2 = ifcopenshell.api.run("system.add_port", self.file)
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcFlowFitting")
ifcopenshell.api.run("system.connect_port", self.file, port1=port, port2=port2, element=element)
port = ifcopenshell.api.system.add_port(self.file)
port2 = ifcopenshell.api.system.add_port(self.file)
element = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcFlowFitting")
ifcopenshell.api.system.connect_port(self.file, port1=port, port2=port2, element=element)
assert self.file.by_type("IfcRelConnectsPorts")[0].RealizingElement == element
ifcopenshell.api.run("system.connect_port", self.file, port1=port, port2=port2)
ifcopenshell.api.system.connect_port(self.file, port1=port, port2=port2)
assert self.file.by_type("IfcRelConnectsPorts")[0].RealizingElement is None
@@ -17,16 +17,16 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import test.bootstrap
import ifcopenshell.api
import ifcopenshell.api.system
import ifcopenshell.util.system
class TestDisconnectPort(test.bootstrap.IFC4):
def test_disconnecting_a_port(self):
port = ifcopenshell.api.run("system.add_port", self.file)
port2 = ifcopenshell.api.run("system.add_port", self.file)
ifcopenshell.api.run("system.connect_port", self.file, port1=port, port2=port2, direction="NOTDEFINED")
ifcopenshell.api.run("system.disconnect_port", self.file, port=port)
port = ifcopenshell.api.system.add_port(self.file)
port2 = ifcopenshell.api.system.add_port(self.file)
ifcopenshell.api.system.connect_port(self.file, port1=port, port2=port2, direction="NOTDEFINED")
ifcopenshell.api.system.disconnect_port(self.file, port=port)
assert port.FlowDirection == None
assert port2.FlowDirection == None
assert len(self.file.by_type("IfcRelConnectsPorts")) == 0
@@ -17,27 +17,29 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import test.bootstrap
import ifcopenshell.api
import ifcopenshell.api.root
import ifcopenshell.api.pset
import ifcopenshell.api.system
class TestRemoveSystem(test.bootstrap.IFC4):
def test_removing_a_system(self):
system = ifcopenshell.api.run("system.add_system", self.file, ifc_class="IfcSystem")
ifcopenshell.api.run("system.remove_system", self.file, system=system)
system = ifcopenshell.api.system.add_system(self.file, ifc_class="IfcSystem")
ifcopenshell.api.system.remove_system(self.file, system=system)
assert len(self.file.by_type("IfcSystem")) == 0
def test_removing_orphaned_group_relationships(self):
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcFlowTerminal")
system = ifcopenshell.api.run("system.add_system", self.file, ifc_class="IfcSystem")
ifcopenshell.api.run("system.assign_system", self.file, products=[element], system=system)
ifcopenshell.api.run("system.remove_system", self.file, system=system)
element = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcFlowTerminal")
system = ifcopenshell.api.system.add_system(self.file, ifc_class="IfcSystem")
ifcopenshell.api.system.assign_system(self.file, products=[element], system=system)
ifcopenshell.api.system.remove_system(self.file, system=system)
assert not self.file.by_type("IfcRelAssignsToGroup")
def test_removing_orphaned_property_relationships(self):
system = ifcopenshell.api.run("system.add_system", self.file, ifc_class="IfcSystem")
pset = ifcopenshell.api.run("pset.add_pset", self.file, product=system, name="Foo_Bar")
ifcopenshell.api.run("pset.edit_pset", self.file, pset=pset, properties={"Foo": "Bar"})
ifcopenshell.api.run("system.remove_system", self.file, system=system)
system = ifcopenshell.api.system.add_system(self.file, ifc_class="IfcSystem")
pset = ifcopenshell.api.pset.add_pset(self.file, product=system, name="Foo_Bar")
ifcopenshell.api.pset.edit_pset(self.file, pset=pset, properties={"Foo": "Bar"})
ifcopenshell.api.system.remove_system(self.file, system=system)
assert not self.file.by_type("IfcRelDefinesByProperties")
assert not self.file.by_type("IfcPropertySet")
assert not self.file.by_type("IfcPropertySingleValue")
@@ -17,7 +17,7 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import test.bootstrap
import ifcopenshell.api
import ifcopenshell.api.system
class TestUnassignFlowControl(test.bootstrap.IFC4):
@@ -26,14 +26,12 @@ class TestUnassignFlowControl(test.bootstrap.IFC4):
flow_control = self.file.create_entity("IfcDistributionControlElement")
# assign and unassign
relation = ifcopenshell.api.run(
"system.assign_flow_control",
relation = ifcopenshell.api.system.assign_flow_control(
self.file,
related_flow_control=flow_control,
relating_flow_element=flow_element,
)
ifcopenshell.api.run(
"system.unassign_flow_control",
ifcopenshell.api.system.unassign_flow_control(
self.file,
related_flow_control=flow_control,
relating_flow_element=flow_element,
@@ -42,20 +40,17 @@ class TestUnassignFlowControl(test.bootstrap.IFC4):
# 1 element 2 controls
flow_control1 = self.file.create_entity("IfcDistributionControlElement")
relation = ifcopenshell.api.run(
"system.assign_flow_control",
relation = ifcopenshell.api.system.assign_flow_control(
self.file,
related_flow_control=flow_control,
relating_flow_element=flow_element,
)
ifcopenshell.api.run(
"system.assign_flow_control",
ifcopenshell.api.system.assign_flow_control(
self.file,
related_flow_control=flow_control1,
relating_flow_element=flow_element,
)
ifcopenshell.api.run(
"system.unassign_flow_control",
ifcopenshell.api.system.unassign_flow_control(
self.file,
related_flow_control=flow_control1,
relating_flow_element=flow_element,
@@ -17,16 +17,17 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import test.bootstrap
import ifcopenshell.api
import ifcopenshell.api.root
import ifcopenshell.api.system
import ifcopenshell.util.system
class TestAssignPort(test.bootstrap.IFC4):
def test_assigning_a_port_once_only(self):
port = self.file.createIfcDistributionPort()
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcFlowSegment")
ifcopenshell.api.run("system.assign_port", self.file, element=element, port=port)
ifcopenshell.api.run("system.unassign_port", self.file, element=element, port=port)
element = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcFlowSegment")
ifcopenshell.api.system.assign_port(self.file, element=element, port=port)
ifcopenshell.api.system.unassign_port(self.file, element=element, port=port)
assert ifcopenshell.util.system.get_ports(element) == []
@@ -18,21 +18,22 @@
import pytest
import test.bootstrap
import ifcopenshell.api
import ifcopenshell.api.root
import ifcopenshell.api.system
import ifcopenshell.util.system
class TestUnassignSystem(test.bootstrap.IFC4):
def test_unassign_system(self):
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcFlowSegment")
element2 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcFlowSegment")
element3 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcFlowSegment")
system = ifcopenshell.api.run("system.add_system", self.file)
ifcopenshell.api.run("system.assign_system", self.file, products=[element, element2, element3], system=system)
ifcopenshell.api.run("system.unassign_system", self.file, products=[element2, element3], system=system)
element = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcFlowSegment")
element2 = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcFlowSegment")
element3 = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcFlowSegment")
system = ifcopenshell.api.system.add_system(self.file)
ifcopenshell.api.system.assign_system(self.file, products=[element, element2, element3], system=system)
ifcopenshell.api.system.unassign_system(self.file, products=[element2, element3], system=system)
assert ifcopenshell.util.system.get_system_elements(system) == [element]
ifcopenshell.api.run("system.unassign_system", self.file, products=[element], system=system)
ifcopenshell.api.system.unassign_system(self.file, products=[element], system=system)
assert ifcopenshell.util.system.get_system_elements(system) == []