@@ -145,31 +145,47 @@ def test_remove_predefined_type_if_type_assignment(self):
145145 This is because the type will have its own PredefinedType, and the element's PredefinedType
146146 will conflict with it. (See #7006)
147147 """
148+ is_ifc2x3 = self .file .schema == "IFC2X3"
148149 element_type = ifcopenshell .api .root .create_entity (self .file , ifc_class = "IfcWallType" )
149- element_type .PredefinedType = "MOVABLE "
150+ element_type .PredefinedType = "POLYGONAL "
150151
151152 element = ifcopenshell .api .root .create_entity (self .file , ifc_class = "IfcWall" )
152- element .PredefinedType = "USERDEFINED"
153+ if not is_ifc2x3 :
154+ # In IFC2X3, there seems to be no example when both type and occurence have PredefinedType.
155+ # So we just ignore it.
156+ element .PredefinedType = "USERDEFINED"
153157 element .ObjectType = "Test"
154158 ifcopenshell .api .type .assign_type (self .file , related_objects = [element ], relating_type = element_type )
155- assert element .PredefinedType is None
159+
160+ if not is_ifc2x3 :
161+ assert element .PredefinedType is None
156162 assert element .ObjectType is None
157163
158164 def test_keep_predefined_type_if_type_assignment_is_notdefined (self ):
159165 """
160166 if an element has a PredefinedType, it will be removed when assigning a type.(See #7006)
161167 This behavior needs to be blocked if the PredefinedType of the typing Entity is set to "NOTDEFINED". (See #7011)
162168 """
169+ is_ifc2x3 = self .file .schema == "IFC2X3"
163170 element_type = ifcopenshell .api .root .create_entity (self .file , ifc_class = "IfcWallType" )
164171 element_type .PredefinedType = "NOTDEFINED"
165172
166173 element = ifcopenshell .api .root .create_entity (self .file , ifc_class = "IfcWall" )
167- element .PredefinedType = "USERDEFINED"
174+ if not is_ifc2x3 :
175+ # In IFC2X3, there seems to be no example when both type and occurence have PredefinedType.
176+ # So we just ignore it.
177+ element .PredefinedType = "USERDEFINED"
168178 element .ObjectType = "Test"
169179 ifcopenshell .api .type .assign_type (self .file , related_objects = [element ], relating_type = element_type )
170- assert element .PredefinedType == "USERDEFINED"
180+
181+ if not is_ifc2x3 :
182+ assert element .PredefinedType == "USERDEFINED"
171183 assert element .ObjectType == "Test"
172184
173185
174186class TestAssignTypeIFC2X3 (test .bootstrap .IFC2X3 , TestAssignType ):
175187 pass
188+
189+
190+ class TestAssignTypeIFC4X3 (test .bootstrap .IFC4X3 , TestAssignType ):
191+ pass
0 commit comments