mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
Fix #4365
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:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user