From eed49859575b6e77ecb6ccb5ef7d47a68941eace Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Fri, 8 Nov 2024 12:23:47 +0500 Subject: [PATCH] get_parts - add test --- .../test/util/test_element.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/ifcopenshell-python/test/util/test_element.py b/src/ifcopenshell-python/test/util/test_element.py index 4bbb62077c..34d8020829 100644 --- a/src/ifcopenshell-python/test/util/test_element.py +++ b/src/ifcopenshell-python/test/util/test_element.py @@ -869,6 +869,25 @@ class TestGetNestIFC2X3(test.bootstrap.IFC2X3, TestGetNestIFC4): pass +class TestGetPartsIFC4(test.bootstrap.IFC4): + def test_run(self): + element = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcElementAssembly") + subelement = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcWindow") + ifcopenshell.api.aggregate.assign_object(self.file, products=[subelement], relating_object=element) + + # Test two separate rels. + rel = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcRelAggregates") + subelement2 = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcWindow") + rel.RelatingObject = element + rel.RelatedObjects = [subelement2] + + assert set(subject.get_parts(element)) == {subelement, subelement2} + + +class TestGetPartsIFC2X3(test.bootstrap.IFC2X3, TestGetPartsIFC4): + pass + + class TestGetReferencedElements(test.bootstrap.IFC4): # TODO: test other references: # IfcExternallyDefinedHatchStyle