mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-17 10:59:17 +00:00
Replace all ifcopenshell.api.run with ifcopenshell.api static functions.
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user