MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / assert_pset

Function assert_pset

src/ifcbimtester/bimtester/util.py:89–106  ·  view source on GitHub ↗
(element, pset_name, prop_name=None, value=None)

Source from the content-addressed store, hash-verified

87
88
89def assert_pset(element, pset_name, prop_name=None, value=None):
90 if value == "NULL":
91 value = None
92 psets = ifcopenshell.util.element.get_psets(site)
93 if pset_name not in psets:
94 assert False, _("The element {} does not have a property set named {}").format(element, pset_name)
95 if prop_name is None:
96 return psets[pset_name]
97 if prop_name not in psets[pset_name]:
98 assert False, _('The element {} does not have a property named "{}" in the pset "{}"').format(
99 element, prop_name, pset_name
100 )
101 if value is None:
102 return psets[pset_name][prop_name]
103 actual_value = psets[pset_name][prop_name]
104 assert actual_value == value, _('We expected a value of "{}" but instead got "{}" for the element {}').format(
105 value, actual_value, element
106 )
107
108
109# TODO: what is this? ... a generic assert method

Callers

nothing calls this directly

Calls 2

_Function · 0.90
formatMethod · 0.80

Tested by

no test coverage detected