From 8f555db5a4405137e85938adb168d6575fcd89ff Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Sun, 9 Jul 2023 22:30:14 +1000 Subject: [PATCH] Forgot to commit updated IfcTester test suite --- src/ifctester/README.md | 2 +- src/ifctester/test/test_facet.py | 176 +++++++++++++++---------------- 2 files changed, 89 insertions(+), 89 deletions(-) diff --git a/src/ifctester/README.md b/src/ifctester/README.md index bf2612d7a7..59b9a4af20 100644 --- a/src/ifctester/README.md +++ b/src/ifctester/README.md @@ -19,7 +19,7 @@ property = ids.Property( name="IsExternal", value="TRUE", propertySet="Pset_WallCommon", - measure="IfcBoolean", + datatype="IfcBoolean", uri="https://identifier.buildingsmart.org/uri/.../prop/LoadBearing", instructions="Walls need to be load bearing.", minOccurs=1, diff --git a/src/ifctester/test/test_facet.py b/src/ifctester/test/test_facet.py index a668a2aae8..b7ab57a384 100644 --- a/src/ifctester/test/test_facet.py +++ b/src/ifctester/test/test_facet.py @@ -838,7 +838,7 @@ class TestProperty: propertySet="propertySet", name="name", value="value", - measure="measure", + datatype="datatype", uri="https://test.com", minOccurs="0", maxOccurs="unbounded", @@ -848,7 +848,7 @@ class TestProperty: "propertySet": {"simpleValue": "propertySet"}, "name": {"simpleValue": "name"}, "value": {"simpleValue": "value"}, - "@measure": "measure", + "@datatype": "datatype", "@uri": "https://test.com", "@minOccurs": "0", "@maxOccurs": "unbounded", @@ -860,7 +860,7 @@ class TestProperty: ifc = self.setup_ifc() - facet = Property(propertySet="Foo_Bar", name="Foo", measure="IfcLabel") + facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IfcLabel") element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall") run("Elements with no properties always fail", facet=facet, inst=element, expected=False) pset = ifcopenshell.api.run("pset.add_pset", ifc, product=element, name="Foo_Bar") @@ -872,27 +872,27 @@ class TestProperty: run("A name check will match any property with any string value", facet=facet, inst=element, expected=True) ifc = self.setup_ifc() - facet = Property(propertySet="Foo_Bar", name="Foo", measure="IfcLabel") + facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IfcLabel") element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall") pset = ifcopenshell.api.run("pset.add_pset", ifc, product=element, name="Foo_Bar") ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": "Bar"}) run("A required facet checks all parameters as normal", facet=facet, inst=element, expected=True) - facet = Property(propertySet="Foo_Bar", name="Foo", measure="IfcLabel", minOccurs=0, maxOccurs=0) + facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IfcLabel", minOccurs=0, maxOccurs=0) run("A prohibited facet returns the opposite of a required facet", facet=facet, inst=element, expected=False) - facet = Property(propertySet="Foo_Bar", name="Foo", measure="IfcLabel", minOccurs=0) + facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IfcLabel", minOccurs=0) run("An optional facet always passes regardless of outcome 1/2", facet=facet, inst=element, expected=True) - facet = Property(propertySet="Foo_Bar", name="Bar", measure="IfcLabel", minOccurs=0) + facet = Property(propertySet="Foo_Bar", name="Bar", datatype="IfcLabel", minOccurs=0) run("An optional facet always passes regardless of outcome 2/2", facet=facet, inst=element, expected=True) ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ""}) - facet = Property(propertySet="Foo_Bar", name="Foo", measure="IfcLogical") + facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IfcLogical") run("An empty string is considered falsey and will not pass", facet=facet, inst=element, expected=False) ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcLogical("UNKNOWN")}) - facet = Property(propertySet="Foo_Bar", name="Foo", measure="IfcDuration") + facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IfcDuration") run("A logical unknown is considered falsey and will not pass", facet=facet, inst=element, expected=False) ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcDuration("P0D")}) run("A zero duration will pass", facet=facet, inst=element, expected=True) - facet = Property(propertySet="Foo_Bar", name="Foo", measure="IfcBoolean") + facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IfcBoolean") ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcBoolean(True)}) run("A property set to true will pass a name check", facet=facet, inst=element, expected=True) ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": False}) @@ -904,7 +904,7 @@ class TestProperty: ) ifc = self.setup_ifc() - facet = Property(propertySet="Foo_Bar", name="Foo", value="Bar", measure="IfcLabel") + facet = Property(propertySet="Foo_Bar", name="Foo", value="Bar", datatype="IfcLabel") element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall") pset = ifcopenshell.api.run("pset.add_pset", ifc, product=element, name="Foo_Bar") ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": "Bar"}) @@ -914,55 +914,55 @@ class TestProperty: ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": "Baz"}) run("Specifying a value fails against different values", facet=facet, inst=element, expected=False) - facet = Property(propertySet="Foo_Bar", name="Foo", value="♫Don'tÄrgerhôtelЊет", measure="IfcLabel") + facet = Property(propertySet="Foo_Bar", name="Foo", value="♫Don'tÄrgerhôtelЊет", datatype="IfcLabel") ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": "♫Don'tÄrgerhôtelЊет"}) run("Non-ascii characters are treated without encoding", facet=facet, inst=element, expected=True) identifier = "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345" facet = Property( - propertySet="Foo_Bar", name="Foo", value=identifier + "_extra_characters", measure="IfcIdentifier" + propertySet="Foo_Bar", name="Foo", value=identifier + "_extra_characters", datatype="IfcIdentifier" ) ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcIdentifier(identifier)}) run("IDS does not handle string truncation such as for identifiers", facet=facet, inst=element, expected=False) ifc = self.setup_ifc() - facet = Property(propertySet="Foo_Bar", name="Foo", value="1", measure="IfcLabel") + facet = Property(propertySet="Foo_Bar", name="Foo", value="1", datatype="IfcLabel") element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall") pset = ifcopenshell.api.run("pset.add_pset", ifc, product=element, name="Foo_Bar") ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": "1"}) run("A number specified as a string is treated as a string", facet=facet, inst=element, expected=True) - facet = Property(propertySet="Foo_Bar", name="Foo", value="42", measure="IfcInteger") + facet = Property(propertySet="Foo_Bar", name="Foo", value="42", datatype="IfcInteger") ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcInteger(42)}) run("Integer values are checked using type casting 1/4", facet=facet, inst=element, expected=True) - facet = Property(propertySet="Foo_Bar", name="Foo", value="42.", measure="IfcInteger") + facet = Property(propertySet="Foo_Bar", name="Foo", value="42.", datatype="IfcInteger") run("Integer values are checked using type casting 2/4", facet=facet, inst=element, expected=True) - facet = Property(propertySet="Foo_Bar", name="Foo", value="42.0", measure="IfcInteger") + facet = Property(propertySet="Foo_Bar", name="Foo", value="42.0", datatype="IfcInteger") run("Integer values are checked using type casting 3/4", facet=facet, inst=element, expected=True) - facet = Property(propertySet="Foo_Bar", name="Foo", value="42.3", measure="IfcInteger") + facet = Property(propertySet="Foo_Bar", name="Foo", value="42.3", datatype="IfcInteger") run("Integer values are checked using type casting 4/4", facet=facet, inst=element, expected=False) - facet = Property(propertySet="Foo_Bar", name="Foo", value="42", measure="IfcReal") + facet = Property(propertySet="Foo_Bar", name="Foo", value="42", datatype="IfcReal") ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcReal(42.0)}) run("Real values are checked using type casting 1/3", facet=facet, inst=element, expected=True) - facet = Property(propertySet="Foo_Bar", name="Foo", value="42.0", measure="IfcReal") + facet = Property(propertySet="Foo_Bar", name="Foo", value="42.0", datatype="IfcReal") run("Real values are checked using type casting 2/3", facet=facet, inst=element, expected=True) - facet = Property(propertySet="Foo_Bar", name="Foo", value="42.3", measure="IfcReal") + facet = Property(propertySet="Foo_Bar", name="Foo", value="42.3", datatype="IfcReal") ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcReal(42.3)}) run("Real values are checked using type casting 3/3", facet=facet, inst=element, expected=True) - facet = Property(propertySet="Foo_Bar", name="Foo", value="42,3", measure="IfcReal") + facet = Property(propertySet="Foo_Bar", name="Foo", value="42,3", datatype="IfcReal") ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcReal(42.3)}) run("Only specifically formatted numbers are allowed 1/4", facet=facet, inst=element, expected=False) - facet = Property(propertySet="Foo_Bar", name="Foo", value="123,4.5", measure="IfcReal") + facet = Property(propertySet="Foo_Bar", name="Foo", value="123,4.5", datatype="IfcReal") ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcReal(1234.5)}) run("Only specifically formatted numbers are allowed 2/4", facet=facet, inst=element, expected=False) - facet = Property(propertySet="Foo_Bar", name="Foo", value="1.2345e3", measure="IfcReal") + facet = Property(propertySet="Foo_Bar", name="Foo", value="1.2345e3", datatype="IfcReal") run("Only specifically formatted numbers are allowed 3/4", facet=facet, inst=element, expected=True) - facet = Property(propertySet="Foo_Bar", name="Foo", value="1.2345E3", measure="IfcReal") + facet = Property(propertySet="Foo_Bar", name="Foo", value="1.2345E3", datatype="IfcReal") run("Only specifically formatted numbers are allowed 4/4", facet=facet, inst=element, expected=True) - facet = Property(propertySet="Foo_Bar", name="Foo", value="42.", measure="IfcReal") + facet = Property(propertySet="Foo_Bar", name="Foo", value="42.", datatype="IfcReal") ifcopenshell.api.run( "pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcReal(42.0 * (1.0 + 1e-6))} ) @@ -980,15 +980,15 @@ class TestProperty: ) run("Floating point numbers are compared with a 1e-6 tolerance 4/4", facet=facet, inst=element, expected=False) - facet = Property(propertySet="Foo_Bar", name="Foo", value="TRUE", measure="IfcBoolean") + facet = Property(propertySet="Foo_Bar", name="Foo", value="TRUE", datatype="IfcBoolean") ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcBoolean(False)}) run("Booleans must be specified as uppercase strings 1/3", facet=facet, inst=element, expected=False) - facet = Property(propertySet="Foo_Bar", name="Foo", value="FALSE", measure="IfcBoolean") + facet = Property(propertySet="Foo_Bar", name="Foo", value="FALSE", datatype="IfcBoolean") run("Booleans must be specified as uppercase strings 2/3", facet=facet, inst=element, expected=True) - facet = Property(propertySet="Foo_Bar", name="Foo", value="False", measure="IfcBoolean") + facet = Property(propertySet="Foo_Bar", name="Foo", value="False", datatype="IfcBoolean") run("Booleans must be specified as uppercase strings 3/3", facet=facet, inst=element, expected=False) - facet = Property(propertySet="Foo_Bar", name="Foo", value="2022-01-01", measure="IfcDate") + facet = Property(propertySet="Foo_Bar", name="Foo", value="2022-01-01", datatype="IfcDate") ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcDate("2022-01-01")}) run("Dates are treated as strings 1/2", facet=facet, inst=element, expected=True) ifcopenshell.api.run( @@ -996,7 +996,7 @@ class TestProperty: ) run("Dates are treated as strings 2/2", facet=facet, inst=element, expected=False) - facet = Property(propertySet="Foo_Bar", name="Foo", value="PT16H", measure="IfcDuration") + facet = Property(propertySet="Foo_Bar", name="Foo", value="PT16H", datatype="IfcDuration") ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcDuration("PT16H")}) run("Durations are treated as strings 1/2", facet=facet, inst=element, expected=True) ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcDuration("P2D")}) @@ -1013,11 +1013,11 @@ class TestProperty: properties={"Status": ["EXISTING", "DEMOLISH"]}, pset_template=pset_template, ) - facet = Property(propertySet="Pset_WallCommon", name="Status", value="EXISTING", measure="IfcLabel") + facet = Property(propertySet="Pset_WallCommon", name="Status", value="EXISTING", datatype="IfcLabel") run("Any matching value in an enumerated property will pass 1/3", facet=facet, inst=element, expected=True) - facet = Property(propertySet="Pset_WallCommon", name="Status", value="DEMOLISH", measure="IfcLabel") + facet = Property(propertySet="Pset_WallCommon", name="Status", value="DEMOLISH", datatype="IfcLabel") run("Any matching value in an enumerated property will pass 2/3", facet=facet, inst=element, expected=True) - facet = Property(propertySet="Pset_WallCommon", name="Status", value="NEW", measure="IfcLabel") + facet = Property(propertySet="Pset_WallCommon", name="Status", value="NEW", datatype="IfcLabel") run("Any matching value in an enumerated property will pass 3/3", facet=facet, inst=element, expected=False) ifc = self.setup_ifc() @@ -1027,11 +1027,11 @@ class TestProperty: Name="Foo", ListValues=[ifc.createIfcLabel("X"), ifc.createIfcLabel("Y")] ) pset.HasProperties = [list_property] - facet = Property(propertySet="Foo_Bar", name="Foo", value="X", measure="IfcLabel") + facet = Property(propertySet="Foo_Bar", name="Foo", value="X", datatype="IfcLabel") run("Any matching value in a list property will pass 1/3", facet=facet, inst=element, expected=True) - facet = Property(propertySet="Foo_Bar", name="Foo", value="Y", measure="IfcLabel") + facet = Property(propertySet="Foo_Bar", name="Foo", value="Y", datatype="IfcLabel") run("Any matching value in a list property will pass 2/3", facet=facet, inst=element, expected=True) - facet = Property(propertySet="Foo_Bar", name="Foo", value="Z", measure="IfcLabel") + facet = Property(propertySet="Foo_Bar", name="Foo", value="Z", datatype="IfcLabel") run("Any matching value in a list property will pass 3/3", facet=facet, inst=element, expected=False) ifc = self.setup_ifc() @@ -1044,13 +1044,13 @@ class TestProperty: SetPointValue=ifc.createIfcLengthMeasure(3000), ) pset.HasProperties = [bounded_property] - facet = Property(propertySet="Foo_Bar", name="Foo", value="1", measure="IfcLengthMeasure") + facet = Property(propertySet="Foo_Bar", name="Foo", value="1", datatype="IfcLengthMeasure") run("Any matching value in a bounded property will pass 1/4", facet=facet, inst=element, expected=True) - facet = Property(propertySet="Foo_Bar", name="Foo", value="5", measure="IfcLengthMeasure") + facet = Property(propertySet="Foo_Bar", name="Foo", value="5", datatype="IfcLengthMeasure") run("Any matching value in a bounded property will pass 2/4", facet=facet, inst=element, expected=True) - facet = Property(propertySet="Foo_Bar", name="Foo", value="3", measure="IfcLengthMeasure") + facet = Property(propertySet="Foo_Bar", name="Foo", value="3", datatype="IfcLengthMeasure") run("Any matching value in a bounded property will pass 3/4", facet=facet, inst=element, expected=True) - facet = Property(propertySet="Foo_Bar", name="Foo", value="2", measure="IfcLengthMeasure") + facet = Property(propertySet="Foo_Bar", name="Foo", value="2", datatype="IfcLengthMeasure") run("Any matching value in a bounded property will pass 4/4", facet=facet, inst=element, expected=False) ifc = self.setup_ifc() @@ -1060,18 +1060,18 @@ class TestProperty: Name="Foo", DefiningValues=[ifc.createIfcLabel("X")], DefinedValues=[ifc.createIfcLengthMeasure(1000)] ) pset.HasProperties = [table_property] - facet = Property(propertySet="Foo_Bar", name="Foo", value="X", measure="IfcLabel") + facet = Property(propertySet="Foo_Bar", name="Foo", value="X", datatype="IfcLabel") run("Any matching value in a table property will pass 1/3", facet=facet, inst=element, expected=True) - facet = Property(propertySet="Foo_Bar", name="Foo", value="1", measure="IfcLengthMeasure") + facet = Property(propertySet="Foo_Bar", name="Foo", value="1", datatype="IfcLengthMeasure") run("Any matching value in a table property will pass 2/3", facet=facet, inst=element, expected=True) - facet = Property(propertySet="Foo_Bar", name="Foo", value="Y", measure="IfcLabel") + facet = Property(propertySet="Foo_Bar", name="Foo", value="Y", datatype="IfcLabel") run("Any matching value in a table property will pass 3/3", facet=facet, inst=element, expected=False) ifc = self.setup_ifc() element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall") pset = ifcopenshell.api.run("pset.add_pset", ifc, product=element, name="Foo_Bar") pset.HasProperties = [ifc.createIfcPropertyReferenceValue(Name="Foo")] - facet = Property(propertySet="Foo_Bar", name="Foo", measure="IfcLabel") + facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IfcLabel") run("Reference properties are treated as objects and not supported", facet=facet, inst=element, expected=False) ifc = self.setup_ifc() @@ -1090,21 +1090,21 @@ class TestProperty: RelatingPropertyDefinition=pset, ) facet = Property( - propertySet="Foo_Bar", name="PanelOperation", value="SWINGING", measure="IfcDoorPanelOperationEnum" + propertySet="Foo_Bar", name="PanelOperation", value="SWINGING", datatype="IfcDoorPanelOperationEnum" ) run("Predefined properties are supported but discouraged 1/2", facet=facet, inst=element, expected=True) facet = Property( - propertySet="Foo_Bar", name="PanelOperation", value="SWONGING", measure="IfcDoorPanelOperationEnum" + propertySet="Foo_Bar", name="PanelOperation", value="SWONGING", datatype="IfcDoorPanelOperationEnum" ) run("Predefined properties are supported but discouraged 2/2", facet=facet, inst=element, expected=False) ifc = self.setup_ifc() - facet = Property(propertySet="Foo_Bar", name="Foo", measure="IfcLengthMeasure") + facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IfcLengthMeasure") element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall") qto = ifcopenshell.api.run("pset.add_qto", ifc, product=element, name="Foo_Bar") ifcopenshell.api.run("pset.edit_qto", ifc, qto=qto, properties={"Foo": ifc.createIfcLengthMeasure(42)}) run("A name check will match any quantity with any value", facet=facet, inst=element, expected=True) - facet = Property(propertySet="Foo_Bar", name="Foo", measure="IfcAreaMeasure") + facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IfcAreaMeasure") run("Quantities must also match the appropriate measure", facet=facet, inst=element, expected=False) ifc = self.setup_ifc() @@ -1113,9 +1113,9 @@ class TestProperty: complex_property = ifc.createIfcComplexProperty(Name="Foo", UsageName="RabbitAgilityTraining") ifcopenshell.api.run("pset.edit_pset", ifc, pset=complex_property, properties={"Rabbits": "Awesome"}) pset.HasProperties = [complex_property] - facet = Property(propertySet="Foo_Bar", name="Foo", measure="IfcLabel") + facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IfcLabel") run("Complex properties are not supported 1/2", facet=facet, inst=element, expected=False) - facet = Property(propertySet="Foo", name="Rabbits", measure="IfcLabel") + facet = Property(propertySet="Foo", name="Rabbits", datatype="IfcLabel") run("Complex properties are not supported 2/2", facet=facet, inst=element, expected=False) ifc = self.setup_ifc() @@ -1126,14 +1126,14 @@ class TestProperty: "pset.edit_qto", ifc, qto=complex_quantity, properties={"MyLength": ifc.createIfcLengthMeasure(42)} ) qto.Quantities = [complex_quantity] - facet = Property(propertySet="Foo_Bar", name="Foo", measure="IfcLengthMeasure") + facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IfcLengthMeasure") run("Complex properties are not supported 1/2", facet=facet, inst=element, expected=False) - facet = Property(propertySet="Foo", name="MyLength", measure="IfcLengthMeasure") + facet = Property(propertySet="Foo", name="MyLength", datatype="IfcLengthMeasure") run("Complex properties are not supported 2/2", facet=facet, inst=element, expected=False) ifc = self.setup_ifc() restriction = Restriction(options={"pattern": "Foo_.*"}) - facet = Property(propertySet=restriction, name="Foo", measure="IfcLabel") + facet = Property(propertySet=restriction, name="Foo", datatype="IfcLabel") element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall") pset = ifcopenshell.api.run("pset.add_pset", ifc, product=element, name="Foo_Bar") ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": "Bar"}) @@ -1146,7 +1146,7 @@ class TestProperty: ifc = self.setup_ifc() restriction = Restriction(options={"pattern": "Foo.*"}) - facet = Property(propertySet="Foo_Bar", name=restriction, value="x", measure="IfcLabel") + facet = Property(propertySet="Foo_Bar", name=restriction, value="x", datatype="IfcLabel") element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall") pset = ifcopenshell.api.run("pset.add_pset", ifc, product=element, name="Foo_Bar") ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foobar": "x"}) @@ -1159,7 +1159,7 @@ class TestProperty: ifc = self.setup_ifc() restriction1 = Restriction(options={"pattern": "Foo.*"}) restriction2 = Restriction(options={"enumeration": ["x", "y"]}) - facet = Property(propertySet="Foo_Bar", name=restriction1, value=restriction2, measure="IfcLabel") + facet = Property(propertySet="Foo_Bar", name=restriction1, value=restriction2, datatype="IfcLabel") element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall") pset = ifcopenshell.api.run("pset.add_pset", ifc, product=element, name="Foo_Bar") ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foobar": "x", "Foobaz": "y"}) @@ -1178,7 +1178,7 @@ class TestProperty: ) ifc = self.setup_ifc() - facet = Property(propertySet="Foo_Bar", name="Foo", value="2", measure="IfcTimeMeasure") + facet = Property(propertySet="Foo_Bar", name="Foo", value="2", datatype="IfcTimeMeasure") element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall") pset = ifcopenshell.api.run("pset.add_pset", ifc, product=element, name="Foo_Bar") ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcMassMeasure(2)}) @@ -1187,7 +1187,7 @@ class TestProperty: run("Measures are used to specify an IFC data type 2/2", facet=facet, inst=element, expected=True) ifc = self.setup_ifc() - facet = Property(propertySet="Foo_Bar", name="Foo", value="2", measure="IfcLengthMeasure") + facet = Property(propertySet="Foo_Bar", name="Foo", value="2", datatype="IfcLengthMeasure") element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall") pset = ifcopenshell.api.run("pset.add_pset", ifc, product=element, name="Foo_Bar") ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcLengthMeasure(2)}) @@ -1211,7 +1211,7 @@ class TestProperty: ifcopenshell.api.run("type.assign_type", ifc, related_object=wall, relating_type=wall_type) pset = ifcopenshell.api.run("pset.add_pset", ifc, product=wall_type, name="Foo_Bar") ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": "Bar"}) - facet = Property(propertySet="Foo_Bar", name="Foo", measure="IfcLabel") + facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IfcLabel") run("Properties can be inherited from the type 1/2", facet=facet, inst=wall, expected=True) run("Properties can be inherited from the type 2/2", facet=facet, inst=wall_type, expected=True) @@ -1223,7 +1223,7 @@ class TestProperty: ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": "Baz"}) pset = ifcopenshell.api.run("pset.add_pset", ifc, product=wall, name="Foo_Bar") ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": "Bar"}) - facet = Property(propertySet="Foo_Bar", name="Foo", value="Bar", measure="IfcLabel") + facet = Property(propertySet="Foo_Bar", name="Foo", value="Bar", datatype="IfcLabel") run("Properties can be overriden by an occurrence 1/2", facet=facet, inst=wall, expected=True) run("Properties can be overriden by an occurrence 2/2", facet=facet, inst=wall_type, expected=False) @@ -1400,11 +1400,11 @@ class TestMaterial: class TestPartOf: def test_creating_a_partof_facet(self): facet = PartOf() - assert facet.asdict() == {"@relation": "IfcRelAggregates"} + assert facet.asdict() == {"entity": {"name": {"simpleValue": "IFCWALL"}}} facet = PartOf( entity="IfcGroup", predefinedType="predefinedType", - relation="IfcRelAssignsToGroup", + relation="IFCRELASSIGNSTOGROUP", minOccurs="0", maxOccurs="unbounded", instructions="instructions", @@ -1414,7 +1414,7 @@ class TestPartOf: "name": {"simpleValue": "IfcGroup"}, "predefinedType": {"simpleValue": "predefinedType"}, }, - "@relation": "IfcRelAssignsToGroup", + "@relation": "IFCRELASSIGNSTOGROUP", "@minOccurs": "0", "@maxOccurs": "unbounded", "@instructions": "instructions", @@ -1427,16 +1427,16 @@ class TestPartOf: element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcElementAssembly") subelement = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall") - facet = PartOf(relation="IfcRelAggregates") + facet = PartOf(entity="IFCELEMENTASSEMBLY", relation="IFCRELAGGREGATES") run("A non aggregated element fails an aggregate relationship", facet=facet, inst=subelement, expected=False) ifcopenshell.api.run("aggregate.assign_object", ifc, product=subelement, relating_object=element) run("The aggregated whole fails an aggregate relationship", facet=facet, inst=element, expected=False) run("The aggregated part passes an aggregate relationship", facet=facet, inst=subelement, expected=True) run("A required facet checks all parameters as normal", facet=facet, inst=subelement, expected=True) - facet = PartOf(relation="IfcRelAggregates", minOccurs=0, maxOccurs=0) + facet = PartOf(entity="IFCELEMENTASSEMBLY", relation="IFCRELAGGREGATES", minOccurs=0, maxOccurs=0) run("A prohibited facet returns the opposite of a required facet", facet=facet, inst=subelement, expected=False) - facet = PartOf(relation="IfcRelAggregates", minOccurs=0) + facet = PartOf(entity="IFCELEMENTASSEMBLY", relation="IFCRELAGGREGATES", minOccurs=0) run("An optional facet always passes regardless of outcome 1/2", facet=facet, inst=element, expected=True) run("An optional facet always passes regardless of outcome 2/2", facet=facet, inst=subelement, expected=True) @@ -1444,17 +1444,17 @@ class TestPartOf: element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcSlab") subelement = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcBeam") ifcopenshell.api.run("aggregate.assign_object", ifc, product=subelement, relating_object=element) - facet = PartOf(entity="IFCSLAB", relation="IfcRelAggregates") + facet = PartOf(entity="IFCSLAB", relation="IFCRELAGGREGATES") run("An aggregate may specify the entity of the whole 1/2", facet=facet, inst=subelement, expected=True) - facet = PartOf(entity="IFCWALL", relation="IfcRelAggregates") + facet = PartOf(entity="IFCWALL", relation="IFCRELAGGREGATES") run("An aggregate may specify the entity of the whole 2/2", facet=facet, inst=subelement, expected=False) element.PredefinedType = "BASESLAB" - facet = PartOf(entity="IFCSLAB", predefinedType="BASESLAB", relation="IfcRelAggregates") + facet = PartOf(entity="IFCSLAB", predefinedType="BASESLAB", relation="IFCRELAGGREGATES") run( "An aggregate may specify the predefined type of the whole 1/2", facet=facet, inst=subelement, expected=True ) - facet = PartOf(entity="IFCSLAB", predefinedType="SLABRADOR", relation="IfcRelAggregates") + facet = PartOf(entity="IFCSLAB", predefinedType="SLABRADOR", relation="IFCRELAGGREGATES") run( "An aggregate may specify the predefined type of the whole 2/2", facet=facet, @@ -1468,13 +1468,13 @@ class TestPartOf: subsubelement = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcBeam") ifcopenshell.api.run("aggregate.assign_object", ifc, product=subelement, relating_object=element) ifcopenshell.api.run("aggregate.assign_object", ifc, product=subsubelement, relating_object=subelement) - facet = PartOf(entity="IFCELEMENTASSEMBLY", relation="IfcRelAggregates") + facet = PartOf(entity="IFCELEMENTASSEMBLY", relation="IFCRELAGGREGATES") run("An aggregate entity may pass any ancestral whole passes", facet=facet, inst=subsubelement, expected=True) ifc = ifcopenshell.file() element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcElementAssembly") group = ifcopenshell.api.run("group.add_group", ifc) - facet = PartOf(relation="IfcRelAssignsToGroup") + facet = PartOf(entity="IFCGROUP", relation="IFCRELASSIGNSTOGROUP") run("A non grouped element fails a group relationship", facet=facet, inst=element, expected=False) ifcopenshell.api.run("group.assign_group", ifc, products=[element], group=group) run("A grouped element passes a group relationship", facet=facet, inst=element, expected=True) @@ -1482,22 +1482,22 @@ class TestPartOf: ifc = ifcopenshell.file() element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcElementAssembly") group = ifc.createIfcInventory() - facet = PartOf(entity="IFCGROUP", relation="IfcRelAssignsToGroup") + facet = PartOf(entity="IFCGROUP", relation="IFCRELASSIGNSTOGROUP") ifcopenshell.api.run("group.assign_group", ifc, products=[element], group=group) run("A group entity must match exactly 1/2", facet=facet, inst=element, expected=False) - facet = PartOf(entity="IFCINVENTORY", relation="IfcRelAssignsToGroup") + facet = PartOf(entity="IFCINVENTORY", relation="IFCRELASSIGNSTOGROUP") run("A group entity must match exactly 2/2", facet=facet, inst=element, expected=True) group.ObjectType = "BUNNY" - facet = PartOf(entity="IFCINVENTORY", predefinedType="BUNNARY", relation="IfcRelAssignsToGroup") + facet = PartOf(entity="IFCINVENTORY", predefinedType="BUNNARY", relation="IFCRELASSIGNSTOGROUP") run("A group predefined type must match exactly 2/2", facet=facet, inst=element, expected=False) - facet = PartOf(entity="IFCINVENTORY", predefinedType="BUNNY", relation="IfcRelAssignsToGroup") + facet = PartOf(entity="IFCINVENTORY", predefinedType="BUNNY", relation="IFCRELASSIGNSTOGROUP") run("A group predefined type must match exactly 2/2", facet=facet, inst=element, expected=True) ifc = ifcopenshell.file() element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcElementAssembly") container = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcSpace") - facet = PartOf(relation="IfcRelContainedInSpatialStructure") + facet = PartOf(entity="IFCSPACE", relation="IFCRELCONTAINEDINSPATIALSTRUCTURE") run("Any contained element passes a containment relationship 1/2", facet=facet, inst=element, expected=False) ifcopenshell.api.run("spatial.assign_container", ifc, product=element, relating_structure=container) run("Any contained element passes a containment relationship 2/2", facet=facet, inst=element, expected=True) @@ -1507,15 +1507,15 @@ class TestPartOf: element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcElementAssembly") container = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcSpace") ifcopenshell.api.run("spatial.assign_container", ifc, product=element, relating_structure=container) - facet = PartOf(relation="IfcRelContainedInSpatialStructure", entity="IFCSITE") + facet = PartOf(relation="IFCRELCONTAINEDINSPATIALSTRUCTURE", entity="IFCSITE") run("The container entity must match exactly 1/2", facet=facet, inst=element, expected=False) - facet = PartOf(relation="IfcRelContainedInSpatialStructure", entity="IFCSPACE") + facet = PartOf(relation="IFCRELCONTAINEDINSPATIALSTRUCTURE", entity="IFCSPACE") run("The container entity must match exactly 2/2", facet=facet, inst=element, expected=True) container.ObjectType = "BURROW" - facet = PartOf(relation="IfcRelContainedInSpatialStructure", entity="IFCSPACE", predefinedType="WARREN") + facet = PartOf(relation="IFCRELCONTAINEDINSPATIALSTRUCTURE", entity="IFCSPACE", predefinedType="WARREN") run("The container predefined type must match exactly 1/2", facet=facet, inst=element, expected=False) - facet = PartOf(relation="IfcRelContainedInSpatialStructure", entity="IFCSPACE", predefinedType="BURROW") + facet = PartOf(relation="IFCRELCONTAINEDINSPATIALSTRUCTURE", entity="IFCSPACE", predefinedType="BURROW") run("The container predefined type must match exactly 2/2", facet=facet, inst=element, expected=True) ifc = ifcopenshell.file() @@ -1524,14 +1524,14 @@ class TestPartOf: ifcopenshell.api.run("aggregate.assign_object", ifc, product=subelement, relating_object=element) container = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcSpace") ifcopenshell.api.run("spatial.assign_container", ifc, product=element, relating_structure=container) - facet = PartOf(relation="IfcRelContainedInSpatialStructure", entity="IFCSPACE") + facet = PartOf(relation="IFCRELCONTAINEDINSPATIALSTRUCTURE", entity="IFCSPACE") run("The container may be indirect", facet=facet, inst=subelement, expected=True) ifc = ifcopenshell.file() element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcFurniture") subelement = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcDiscreteAccessory") ifcopenshell.api.run("nest.assign_object", ifc, related_object=subelement, relating_object=element) - facet = PartOf(relation="IfcRelNests") + facet = PartOf(entity="IFCFURNITURE", relation="IFCRELNESTS") run("Any nested part passes a nest relationship", facet=facet, inst=subelement, expected=True) run("Any nested whole fails a nest relationship", facet=facet, inst=element, expected=False) @@ -1539,16 +1539,16 @@ class TestPartOf: element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcFurniture") subelement = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcDiscreteAccessory") ifcopenshell.api.run("nest.assign_object", ifc, related_object=subelement, relating_object=element) - facet = PartOf(relation="IfcRelNests", entity="IFCBEAM") + facet = PartOf(relation="IFCRELNESTS", entity="IFCBEAM") run("The nest entity must match exactly 1/2", facet=facet, inst=subelement, expected=False) - facet = PartOf(relation="IfcRelNests", entity="IFCFURNITURE") + facet = PartOf(relation="IFCRELNESTS", entity="IFCFURNITURE") run("The nest entity must match exactly 2/2", facet=facet, inst=subelement, expected=True) element.PredefinedType = "USERDEFINED" element.ObjectType = "WATERBOTTLE" - facet = PartOf(relation="IfcRelNests", entity="IFCFURNITURE", predefinedType="LITTERBOX") + facet = PartOf(relation="IFCRELNESTS", entity="IFCFURNITURE", predefinedType="LITTERBOX") run("The nest predefined type must match exactly 1/2", facet=facet, inst=subelement, expected=False) - facet = PartOf(relation="IfcRelNests", entity="IFCFURNITURE", predefinedType="WATERBOTTLE") + facet = PartOf(relation="IFCRELNESTS", entity="IFCFURNITURE", predefinedType="WATERBOTTLE") run("The nest predefined type must match exactly 2/2", facet=facet, inst=subelement, expected=True) ifc = ifcopenshell.file() @@ -1557,7 +1557,7 @@ class TestPartOf: subsubelement = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcMechanicalFastener") ifcopenshell.api.run("nest.assign_object", ifc, related_object=subelement, relating_object=element) ifcopenshell.api.run("nest.assign_object", ifc, related_object=subsubelement, relating_object=subelement) - facet = PartOf(relation="IfcRelNests", entity="IFCFURNITURE") + facet = PartOf(relation="IFCRELNESTS", entity="IFCFURNITURE") run("Nesting may be indirect", facet=facet, inst=subsubelement, expected=True)