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

Function assert_attribute

src/ifcbimtester/bimtester/util.py:72–86  ·  view source on GitHub ↗
(element, name, value=None)

Source from the content-addressed store, hash-verified

70
71
72def assert_attribute(element, name, value=None):
73 if not hasattr(element, name):
74 assert False, _("The element {} does not have the attribute {}").format(element, name)
75 if not value:
76 if getattr(element, name) is None:
77 assert False, _("The element {} does not have a value for the attribute {}").format(element, name)
78 return getattr(element, name)
79 if value == "NULL":
80 value = None
81 actual_value = getattr(element, name)
82 if isinstance(value, list) and actual_value:
83 actual_value = list(actual_value)
84 assert actual_value == value, _('We expected a value of "{}" but instead got "{}" for the element {}').format(
85 value, actual_value, element
86 )
87
88
89def assert_pset(element, pset_name, prop_name=None, value=None):

Callers

nothing calls this directly

Calls 2

_Function · 0.90
formatMethod · 0.80

Tested by

no test coverage detected