From bdec4434107ceaa223398c816d7799a08d70c026 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Sat, 12 Nov 2022 14:07:40 +1100 Subject: [PATCH] Minor fixes to IfcTester --- src/ifctester/ifctester/facet.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/ifctester/ifctester/facet.py b/src/ifctester/ifctester/facet.py index 8a03ebbc71..eb81badc34 100644 --- a/src/ifctester/ifctester/facet.py +++ b/src/ifctester/ifctester/facet.py @@ -348,7 +348,7 @@ class PartOf(Facet): if "entity" in xml: super().parse(xml["entity"]) del xml["entity"] - super().parse(xml) + return super().parse(xml) def __call__(self, inst, logger=None): if self.minOccurs == 0 and self.maxOccurs != 0: @@ -527,7 +527,8 @@ class Property(Facet): break unit = ifcopenshell.util.unit.get_property_unit(prop_entity, inst.wrapped_data.file) - if unit: + if unit and getattr(unit, "Name", None): + # TODO support unnamed derived units props[pset_name][prop_entity.Name] = ifcopenshell.util.unit.convert( prop_entity.NominalValue.wrappedValue, getattr(unit, "Prefix", None), @@ -782,7 +783,7 @@ class Restriction: return self self.base = ids_dict.get("@base", "xs:string")[3:] for key, value in ids_dict.items(): - if key == "@base": + if key in ["@base", "annotation"]: continue if isinstance(value, dict): self.options[key.split(":")[-1]] = value["@value"] @@ -826,16 +827,16 @@ class Restriction: if len(str(other)) < int(value): return False elif constraint == "maxExclusive": - if float(other) >= value: + if float(other) >= float(value): return False elif constraint == "maxInclusive": - if float(other) > value: + if float(other) > float(value): return False elif constraint == "minExclusive": - if float(other) <= value: + if float(other) <= float(value): return False elif constraint == "minInclusive": - if float(other) < value: + if float(other) < float(value): return False return True