diff --git a/src/ifcopenshell-python/test/api/pset/test_edit_pset.py b/src/ifcopenshell-python/test/api/pset/test_edit_pset.py index 52d7404693..54e1d61633 100644 --- a/src/ifcopenshell-python/test/api/pset/test_edit_pset.py +++ b/src/ifcopenshell-python/test/api/pset/test_edit_pset.py @@ -16,6 +16,7 @@ # You should have received a copy of the GNU Lesser General Public License # along with IfcOpenShell. If not, see . +import operator import test.bootstrap import ifcopenshell.api @@ -166,6 +167,22 @@ class TestEditPset(test.bootstrap.IFC4): assert pset.HasProperties[0].NominalValue.is_a("IfcContextDependentMeasure") assert pset.HasProperties[0].NominalValue.wrappedValue == 34 + def test_editing_list_valued_properties(self): + cable = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcDistributionPort", predefined_type="CABLE") + pset = ifcopenshell.api.run("pset.add_pset", self.file, product=cable, name="Pset_DistributionPortTypeCable") + ifcopenshell.api.run( + "pset.edit_pset", + self.file, + pset=pset, + properties={ + "Protocols": ["One", "Two", "Three"], + }, + ) + assert pset.HasProperties[0].is_a('IfcPropertyListValue') + assert len(pset.HasProperties[0].ListValues) == 3 + assert set(map(ifcopenshell.entity_instance.is_a, pset.HasProperties[0].ListValues)) == {'IfcIdentifier'} + assert list(map(operator.itemgetter(0), pset.HasProperties[0].ListValues)) == ['One', 'Two', 'Three'] + def test_editing_properties_with_an_explicit_type(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="Foo_Bar")