From b8e2e693f129962450bd6c74bc3b670ed1678b6f Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Tue, 4 Jul 2023 15:48:11 +1000 Subject: [PATCH] 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. --- src/ifctester/ifctester/facet.py | 12 +++++++++--- src/ifctester/test/test_ids.py | 6 +++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/ifctester/ifctester/facet.py b/src/ifctester/ifctester/facet.py index f2b6396605..1a7b2357a3 100644 --- a/src/ifctester/ifctester/facet.py +++ b/src/ifctester/ifctester/facet.py @@ -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 diff --git a/src/ifctester/test/test_ids.py b/src/ifctester/test/test_ids.py index 2bdcde22f2..77dab8c5dd 100644 --- a/src/ifctester/test/test_ids.py +++ b/src/ifctester/test/test_ids.py @@ -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": []}, }