Fixed bug where enumeration values in psets could be empty lists.

This commit is contained in:
Dion Moult
2023-03-27 23:08:40 +11:00
parent 7f78df595f
commit fab76bbcde
2 changed files with 13 additions and 12 deletions
@@ -28,7 +28,7 @@ class TestEditPset(test.bootstrap.IFC4):
"pset.edit_pset",
self.file,
pset=pset,
properties={"Reference": "reference", "Status": "NEW", "Combustible": True, "ThermalTransmittance": 42},
properties={"Reference": "reference", "Status": ["NEW"], "Combustible": True, "ThermalTransmittance": 42},
)
pset = element.IsDefinedBy[0].RelatingPropertyDefinition
@@ -37,8 +37,8 @@ class TestEditPset(test.bootstrap.IFC4):
assert pset.HasProperties[0].NominalValue.wrappedValue == "reference"
assert pset.HasProperties[1].Name == "Status"
assert pset.HasProperties[1].NominalValue.is_a("IfcLabel")
assert pset.HasProperties[1].NominalValue.wrappedValue == "NEW"
assert pset.HasProperties[1].EnumerationValues[0].is_a("IfcLabel")
assert pset.HasProperties[1].EnumerationValues[0].wrappedValue == "NEW"
assert pset.HasProperties[2].Name == "Combustible"
assert pset.HasProperties[2].NominalValue.is_a("IfcBoolean")
@@ -55,9 +55,9 @@ class TestEditPset(test.bootstrap.IFC4):
"pset.edit_pset",
self.file,
pset=pset,
properties={"Reference": "foo", "Status": "NEW", "Combustible": True, "ThermalTransmittance": 42},
properties={"Reference": "foo", "Status": ["NEW"], "Combustible": True, "ThermalTransmittance": 42},
)
ifcopenshell.api.run("pset.edit_pset", self.file, pset=pset, properties={"Reference": "bar", "Status": None})
ifcopenshell.api.run("pset.edit_pset", self.file, pset=pset, properties={"Reference": "bar", "Status": []})
pset = element.IsDefinedBy[0].RelatingPropertyDefinition
assert pset.HasProperties[0].Name == "Reference"
@@ -65,7 +65,7 @@ class TestEditPset(test.bootstrap.IFC4):
assert pset.HasProperties[0].NominalValue.wrappedValue == "bar"
assert pset.HasProperties[1].Name == "Status"
assert pset.HasProperties[1].NominalValue is None
assert pset.HasProperties[1].EnumerationValues is None
def test_editing_a_templated_pset_with_automatic_casting_of_primitive_data_types(self):
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")