@@ -230,6 +230,32 @@ def test_filtering_using_an_entity_facet(self):
230230 wall3 = ifcopenshell .api .root .create_entity (ifc , ifc_class = "IfcWall" , predefined_type = "BAZFOO" )
231231 run ("Restrictions an be specified for the predefined type 3/3" , facet = facet , inst = wall3 , expected = False )
232232
233+ def test_ifc2x3_occurrence_type_mapping (self ):
234+ set_facet ("entity" )
235+
236+ ifc = ifcopenshell .file (schema = "IFC2X3" )
237+ application = ifcopenshell .api .owner .add_application (ifc )
238+ person = ifcopenshell .api .owner .add_person (
239+ ifc , identification = "LPARTEE" , family_name = "Partee" , given_name = "Leeable"
240+ )
241+ organisation = ifcopenshell .api .owner .add_organisation (
242+ ifc , identification = "AWB" , name = "Architects Without Ballpens"
243+ )
244+ user = ifcopenshell .api .owner .add_person_and_organisation (ifc , person = person , organisation = organisation )
245+ ifcopenshell .api .owner .settings .get_user = lambda x : user
246+ ifcopenshell .api .owner .settings .get_application = lambda x : application
247+
248+ element = ifcopenshell .api .root .create_entity (ifc , "IfcFlowTerminal" )
249+ element_type = ifcopenshell .api .root .create_entity (ifc , "IfcAirTerminalType" )
250+ ifcopenshell .api .type .assign_type (ifc , related_objects = [element ], relating_type = element_type )
251+ facet = Entity (name = "IFCAIRTERMINAL" )
252+ assert facet .filter (ifc ) == [element ]
253+ run ("In IFC2X3 the type class is checked instead 1/2" , facet = facet , inst = element , expected = True )
254+
255+ facet = Entity (name = "IFCELECTRICAPPLIANCE" )
256+ assert facet .filter (ifc ) == []
257+ run ("In IFC2X3 the type class is checked instead 2/2" , facet = facet , inst = element , expected = False )
258+
233259 def test_to_string_required_applicability (self ):
234260 spec = ifctester .ids .Specification (name = "Foo" , minOccurs = 1 , maxOccurs = "unbounded" )
235261 facet = Entity (name = "IFCWALL" )
0 commit comments