Skip to content

Commit 2027c71

Browse files
committed
Fix #7164. Property facets with a restriction in the baseName would incorrectly test null values.
Our tests missed this detail. The previous test also did should_purge=True by default which doesn't property test for nullness.
1 parent 6da51c2 commit 2027c71

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/ifctester/ifctester/facet.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,9 @@ def __call__(self, inst: ifcopenshell.entity_instance, logger: Optional[Logger]
688688
elif prop is not None and prop != "":
689689
props[pset_name][self.baseName] = prop
690690
else:
691-
props[pset_name] = {k: v for k, v in pset_props.items() if k == self.baseName}
691+
props[pset_name] = {
692+
k: v for k, v in pset_props.items() if k == self.baseName and v is not None and v != ""
693+
}
692694

693695
if not bool(props[pset_name]):
694696
if self.cardinality == "optional":

src/ifctester/test/test_facet.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -921,8 +921,11 @@ def test_filtering_using_a_property_facet(self):
921921
pset = ifcopenshell.api.pset.add_pset(ifc, product=element, name="Foo_Bar")
922922
ifcopenshell.api.pset.edit_pset(ifc, pset=pset, properties={"AnotherProperty": "AnotherValue"})
923923
run("Elements with a matching pset but no property also fail", facet=facet, inst=element, expected=False)
924-
ifcopenshell.api.pset.edit_pset(ifc, pset=pset, properties={"AnotherProperty": None})
924+
ifcopenshell.api.pset.edit_pset(ifc, pset=pset, properties={"Foo": None}, should_purge=False)
925925
run("Properties with a null value fail", facet=facet, inst=element, expected=False)
926+
restriction = Restriction(options={"pattern": "Fo.*"})
927+
facet = Property(propertySet="Foo_Bar", baseName=restriction, dataType="IFCLABEL")
928+
run("Pattern matched properties with a null value fail", facet=facet, inst=element, expected=False)
926929
ifcopenshell.api.pset.edit_pset(ifc, pset=pset, properties={"Foo": "Bar"})
927930
run("A name check will match any property with any string value", facet=facet, inst=element, expected=True)
928931

0 commit comments

Comments
 (0)