Fix bug where IfcTester would pass derived attribute facets.

Now that IfcOpenShell supports derived attributes, we need to explicitly make sure the attribute facet only considers forward attributes.
This commit is contained in:
Dion Moult
2023-07-04 15:48:11 +10:00
parent 9af7ddaf56
commit b8e2e693f1
2 changed files with 12 additions and 6 deletions
+9 -3
View File
@@ -186,15 +186,21 @@ class Attribute(Facet):
if isinstance(self.name, str):
names = [self.name]
values = [getattr(inst, self.name, None)]
attribute_type = inst.wrapped_data.get_attribute_category(self.name)
if attribute_type == 1: # Forward attribute
values = [getattr(inst, self.name, None)]
else:
values = [None]
else:
info = inst.get_info()
names = []
values = []
for k, v in info.items():
if k == self.name:
names.append(k)
values.append(v)
attribute_type = inst.wrapped_data.get_attribute_category(k)
if attribute_type == 1: # Forward attribute
names.append(k)
values.append(v)
is_pass = bool(values)
reason = None
+3 -3
View File
@@ -52,7 +52,7 @@ class TestIds:
"@xmlns": "http://standards.buildingsmart.org/IDS",
"@xmlns:xs": "http://www.w3.org/2001/XMLSchema",
"@xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
"@xsi:schemaLocation": "http://standards.buildingsmart.org/IDS/ids_05.xsd",
"@xsi:schemaLocation": "http://standards.buildingsmart.org/IDS/ids_09.xsd",
"info": {"title": "Untitled"},
"specifications": {"specification": []},
}
@@ -72,7 +72,7 @@ class TestIds:
"@xmlns": "http://standards.buildingsmart.org/IDS",
"@xmlns:xs": "http://www.w3.org/2001/XMLSchema",
"@xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
"@xsi:schemaLocation": "http://standards.buildingsmart.org/IDS/ids_05.xsd",
"@xsi:schemaLocation": "http://standards.buildingsmart.org/IDS/ids_09.xsd",
"info": {
"title": "title",
"copyright": "copyright",
@@ -92,7 +92,7 @@ class TestIds:
"@xmlns": "http://standards.buildingsmart.org/IDS",
"@xmlns:xs": "http://www.w3.org/2001/XMLSchema",
"@xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
"@xsi:schemaLocation": "http://standards.buildingsmart.org/IDS/ids_05.xsd",
"@xsi:schemaLocation": "http://standards.buildingsmart.org/IDS/ids_09.xsd",
"info": {"title": "Untitled"},
"specifications": {"specification": []},
}