Allowing to add new properties with None values if should_purge is not set to True (and it's False by default)
This commit is contained in:
Andrej730
2024-02-27 17:10:10 +05:00
parent 7f37ba2fad
commit a86ac68e0c
2 changed files with 15 additions and 4 deletions
@@ -84,11 +84,19 @@ class TestEditPset(test.bootstrap.IFC4):
assert pset.HasProperties[0].NominalValue.is_a("IfcThermalTransmittanceMeasure")
assert pset.HasProperties[0].NominalValue.wrappedValue == 42
def test_not_adding_a_property_if_it_is_none(self):
def test_adding_a_property_if_it_is_none(self):
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
pset = ifcopenshell.api.run("pset.add_pset", self.file, product=element, name="Pset_WallCommon")
# should_purge is false by default
ifcopenshell.api.run("pset.edit_pset", self.file, pset=pset, properties={"Reference": None})
pset = element.IsDefinedBy[0].RelatingPropertyDefinition
assert len(pset.HasProperties) == 1
def test_not_adding_a_property_if_it_is_none_and_should_purge_is_true(self):
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
pset = ifcopenshell.api.run("pset.add_pset", self.file, product=element, name="Pset_WallCommon")
ifcopenshell.api.run("pset.edit_pset", self.file, pset=pset, properties={"Reference": None}, should_purge=True)
pset = element.IsDefinedBy[0].RelatingPropertyDefinition
assert len(pset.HasProperties) == 0
def test_removing_a_none_property_if_specified(self):