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,27 +17,29 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import test.bootstrap
import ifcopenshell.api
import ifcopenshell.api.pset
import ifcopenshell.api.root
import ifcopenshell.api.group
class TestRemoveGroup(test.bootstrap.IFC4):
def test_removing_a_group(self):
group = ifcopenshell.api.run("group.add_group", self.file)
ifcopenshell.api.run("group.remove_group", self.file, group=group)
group = ifcopenshell.api.group.add_group(self.file)
ifcopenshell.api.group.remove_group(self.file, group=group)
assert len(self.file.by_type("IfcGroup")) == 0
def test_removing_orphaned_group_relationships(self):
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
group = ifcopenshell.api.run("group.add_group", self.file)
ifcopenshell.api.run("group.assign_group", self.file, products=[element], group=group)
ifcopenshell.api.run("group.remove_group", self.file, group=group)
element = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcWall")
group = ifcopenshell.api.group.add_group(self.file)
ifcopenshell.api.group.assign_group(self.file, products=[element], group=group)
ifcopenshell.api.group.remove_group(self.file, group=group)
assert not self.file.by_type("IfcRelAssignsToGroup")
def test_removing_orphaned_property_relationships(self):
group = ifcopenshell.api.run("group.add_group", self.file)
pset = ifcopenshell.api.run("pset.add_pset", self.file, product=group, name="Foo_Bar")
ifcopenshell.api.run("pset.edit_pset", self.file, pset=pset, properties={"Foo": "Bar"})
ifcopenshell.api.run("group.remove_group", self.file, group=group)
group = ifcopenshell.api.group.add_group(self.file)
pset = ifcopenshell.api.pset.add_pset(self.file, product=group, name="Foo_Bar")
ifcopenshell.api.pset.edit_pset(self.file, pset=pset, properties={"Foo": "Bar"})
ifcopenshell.api.group.remove_group(self.file, group=group)
assert not self.file.by_type("IfcRelDefinesByProperties")
assert not self.file.by_type("IfcPropertySet")
assert not self.file.by_type("IfcPropertySingleValue")