ifc2x3 tests

This commit is contained in:
Andrej730
2024-05-15 15:46:45 +05:00
parent bb8e84e5ec
commit 335e2b7a78
10 changed files with 47 additions and 11 deletions
@@ -27,7 +27,7 @@ class TestRemoveGroup(test.bootstrap.IFC4):
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="IfcPump")
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)
@@ -41,3 +41,7 @@ class TestRemoveGroup(test.bootstrap.IFC4):
assert not self.file.by_type("IfcRelDefinesByProperties")
assert not self.file.by_type("IfcPropertySet")
assert not self.file.by_type("IfcPropertySingleValue")
class TestRemoveGroupIFC2X3(test.bootstrap.IFC2X3, TestRemoveGroup):
pass
@@ -22,9 +22,9 @@ import ifcopenshell.api
class TestAssignGroup(test.bootstrap.IFC4):
def test_group_unassignment(self):
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcPump")
element2 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcPump")
element3 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcPump")
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
element2 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
element3 = 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, element2, element3], group=group)
ifcopenshell.api.run("group.unassign_group", self.file, products=[element2, element3], group=group)
@@ -35,9 +35,13 @@ class TestAssignGroup(test.bootstrap.IFC4):
assert rel.RelatedObjects == (element,)
def test_remove_relationship_unassigning_last_element(self):
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcPump")
element2 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcPump")
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
element2 = 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, element2], group=group)
ifcopenshell.api.run("group.unassign_group", self.file, products=[element, element2], group=group)
assert len(self.file.by_type("IfcRelAssignsToGroup")) == 0
class TestAssignGroupIFC2X3(test.bootstrap.IFC2X3, TestAssignGroup):
pass