mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-23 13:36:25 +00:00
Add test
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import operator
|
||||||
import test.bootstrap
|
import test.bootstrap
|
||||||
import ifcopenshell.api
|
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.is_a("IfcContextDependentMeasure")
|
||||||
assert pset.HasProperties[0].NominalValue.wrappedValue == 34
|
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):
|
def test_editing_properties_with_an_explicit_type(self):
|
||||||
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
|
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")
|
pset = ifcopenshell.api.run("pset.add_pset", self.file, product=element, name="Foo_Bar")
|
||||||
|
|||||||
Reference in New Issue
Block a user