From 335e2b7a788a94ba717b346fc407f1906c08b210 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Wed, 15 May 2024 15:46:45 +0500 Subject: [PATCH] ifc2x3 tests --- .../test/api/geometry/test_add_boolean.py | 4 ++++ .../api/geometry/test_assign_representation.py | 4 ++++ .../test/api/geometry/test_connect_element.py | 6 +++++- .../test/api/geometry/test_connect_path.py | 4 ++++ .../test/api/geometry/test_disconnect_element.py | 6 +++++- .../test/api/geometry/test_disconnect_path.py | 4 ++++ .../api/geometry/test_edit_object_placement.py | 6 +++--- .../test/api/grid/test_create_grid_axis.py | 4 ++++ .../test/api/group/test_remove_group.py | 6 +++++- .../test/api/group/test_unassign_group.py | 14 +++++++++----- 10 files changed, 47 insertions(+), 11 deletions(-) diff --git a/src/ifcopenshell-python/test/api/geometry/test_add_boolean.py b/src/ifcopenshell-python/test/api/geometry/test_add_boolean.py index 10e938b5b4..7f4dd68b00 100644 --- a/src/ifcopenshell-python/test/api/geometry/test_add_boolean.py +++ b/src/ifcopenshell-python/test/api/geometry/test_add_boolean.py @@ -53,3 +53,7 @@ class TestAddBoolean(test.bootstrap.IFC4): ifcopenshell.api.run("geometry.add_boolean", self.file, representation=rep, matrix=np.eye(4)) assert rep.Items[0].is_a() == "IfcBooleanClippingResult" assert rep.RepresentationType == "Clipping" + + +class TestAddBooleanIFC2X3(test.bootstrap.IFC2X3, TestAddBoolean): + pass diff --git a/src/ifcopenshell-python/test/api/geometry/test_assign_representation.py b/src/ifcopenshell-python/test/api/geometry/test_assign_representation.py index 654e4d383a..3a33261107 100644 --- a/src/ifcopenshell-python/test/api/geometry/test_assign_representation.py +++ b/src/ifcopenshell-python/test/api/geometry/test_assign_representation.py @@ -89,3 +89,7 @@ class TestAssignRepresentation(test.bootstrap.IFC4): assert wall.Representation.Representations[0].RepresentationType != "MappedRepresentation" assert wall.Representation.Representations[0] == rep assert not walltype.RepresentationMaps + + +class TestAssignRepresentationIFC2X3(test.bootstrap.IFC2X3, TestAssignRepresentation): + pass diff --git a/src/ifcopenshell-python/test/api/geometry/test_connect_element.py b/src/ifcopenshell-python/test/api/geometry/test_connect_element.py index 1b4123b731..8550b7b016 100644 --- a/src/ifcopenshell-python/test/api/geometry/test_connect_element.py +++ b/src/ifcopenshell-python/test/api/geometry/test_connect_element.py @@ -20,7 +20,7 @@ import test.bootstrap import ifcopenshell.api -class TestConnectPath(test.bootstrap.IFC4): +class TestConnectElement(test.bootstrap.IFC4): def test_connecting_an_element(self): wall1 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall") wall2 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall") @@ -85,3 +85,7 @@ class TestConnectPath(test.bootstrap.IFC4): ) assert rel.RelatingElement == wall2 assert rel.RelatedElement == wall1 + + +class TestConnectElementIFC2X3(test.bootstrap.IFC2X3, TestConnectElement): + pass diff --git a/src/ifcopenshell-python/test/api/geometry/test_connect_path.py b/src/ifcopenshell-python/test/api/geometry/test_connect_path.py index d5b38b8d30..468c38754a 100644 --- a/src/ifcopenshell-python/test/api/geometry/test_connect_path.py +++ b/src/ifcopenshell-python/test/api/geometry/test_connect_path.py @@ -146,3 +146,7 @@ class TestConnectPath(test.bootstrap.IFC4): related_connection=related_connection, description=description, ) + + +class TestConnectPathIFC2X3(test.bootstrap.IFC2X3, TestConnectPath): + pass diff --git a/src/ifcopenshell-python/test/api/geometry/test_disconnect_element.py b/src/ifcopenshell-python/test/api/geometry/test_disconnect_element.py index ebb3b8c7a8..2920231624 100644 --- a/src/ifcopenshell-python/test/api/geometry/test_disconnect_element.py +++ b/src/ifcopenshell-python/test/api/geometry/test_disconnect_element.py @@ -20,7 +20,7 @@ import test.bootstrap import ifcopenshell.api -class TestDisconnectPath(test.bootstrap.IFC4): +class TestDisconnectElement(test.bootstrap.IFC4): def test_disconnecting_an_element(self): wall1 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall") wall2 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall") @@ -34,3 +34,7 @@ class TestDisconnectPath(test.bootstrap.IFC4): ifcopenshell.api.run("geometry.connect_element", self.file, relating_element=wall1, related_element=wall2) ifcopenshell.api.run("geometry.disconnect_element", self.file, relating_element=wall2, related_element=wall1) assert not self.file.by_type("IfcRelConnectsElements") + + +class TestDisconnectElementIFC2X3(test.bootstrap.IFC2X3, TestDisconnectElement): + pass diff --git a/src/ifcopenshell-python/test/api/geometry/test_disconnect_path.py b/src/ifcopenshell-python/test/api/geometry/test_disconnect_path.py index 9c0aacbd31..a09eba8725 100644 --- a/src/ifcopenshell-python/test/api/geometry/test_disconnect_path.py +++ b/src/ifcopenshell-python/test/api/geometry/test_disconnect_path.py @@ -68,3 +68,7 @@ class TestDisconnectPath(test.bootstrap.IFC4): total_elements = len([e for e in self.file]) ifcopenshell.api.run("geometry.disconnect_path", self.file, relating_element=wall2, related_element=wall1) assert len([e for e in self.file]) == total_elements + + +class TestDisconnectPathIFC2X3(test.bootstrap.IFC2X3, TestDisconnectPath): + pass diff --git a/src/ifcopenshell-python/test/api/geometry/test_edit_object_placement.py b/src/ifcopenshell-python/test/api/geometry/test_edit_object_placement.py index 2eb72d33b9..ff7a9c587a 100644 --- a/src/ifcopenshell-python/test/api/geometry/test_edit_object_placement.py +++ b/src/ifcopenshell-python/test/api/geometry/test_edit_object_placement.py @@ -268,7 +268,7 @@ class TestEditObjectPlacement(test.bootstrap.IFC4): def test_changing_placements_relative_to_a_nest_parent(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="IfcChiller") + element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcFlowSegment") subelement = ifcopenshell.api.run("system.add_port", self.file, element=element) matrix = numpy.array( ( @@ -546,7 +546,7 @@ class TestEditObjectPlacement(test.bootstrap.IFC4): def test_changing_placements_always_affecting_child_ports_as_a_special_case(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="IfcChiller") + element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcFlowSegment") subelement = ifcopenshell.api.run("system.add_port", self.file, element=element) matrix = numpy.eye(4) @@ -662,7 +662,7 @@ class TestEditObjectPlacement(test.bootstrap.IFC4): assert numpy.array_equal(ifcopenshell.util.placement.get_local_placement(wall.ObjectPlacement), matrix) -class TestEditObjectPlacementIFC2X3(test.bootstrap.IFC2X3): +class TestEditObjectPlacementIFC2X3(test.bootstrap.IFC2X3, TestEditObjectPlacement): def test_changing_placements_relative_to_a_distribution_element(self): ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcProject") ifcopenshell.api.run("unit.assign_unit", self.file) diff --git a/src/ifcopenshell-python/test/api/grid/test_create_grid_axis.py b/src/ifcopenshell-python/test/api/grid/test_create_grid_axis.py index 524f5fcc33..ef151cc2ee 100644 --- a/src/ifcopenshell-python/test/api/grid/test_create_grid_axis.py +++ b/src/ifcopenshell-python/test/api/grid/test_create_grid_axis.py @@ -33,3 +33,7 @@ class TestCreateGridAxis(test.bootstrap.IFC4): "grid.create_grid_axis", self.file, axis_tag="axis_tag", same_sense=True, uvw_axes="UAxes", grid=grid ) assert grid.UAxes == (axis, axis2) + + +class TestCreateGridAxisIFC2X3(test.bootstrap.IFC2X3, TestCreateGridAxis): + pass diff --git a/src/ifcopenshell-python/test/api/group/test_remove_group.py b/src/ifcopenshell-python/test/api/group/test_remove_group.py index c5b55f3006..5936a40058 100644 --- a/src/ifcopenshell-python/test/api/group/test_remove_group.py +++ b/src/ifcopenshell-python/test/api/group/test_remove_group.py @@ -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 diff --git a/src/ifcopenshell-python/test/api/group/test_unassign_group.py b/src/ifcopenshell-python/test/api/group/test_unassign_group.py index d7b1179f03..86029ab6d9 100644 --- a/src/ifcopenshell-python/test/api/group/test_unassign_group.py +++ b/src/ifcopenshell-python/test/api/group/test_unassign_group.py @@ -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