Update IfcTester to support changed upstream spec where prohibited specs cannot have requirements.

This commit is contained in:
Dion Moult
2025-09-30 00:05:57 +10:00
parent 53def55dc9
commit 6da51c2a6e
2 changed files with 11 additions and 5 deletions
+1
View File
@@ -136,6 +136,7 @@ class Facet:
elif requirement.cardinality == "prohibited":
templates = self.prohibited_templates
elif requirement.cardinality == "optional":
templates = self.requirement_templates
templates = [
t.replace("shall", "may").replace("Shall", "May").replace("must", "may") for t in templates
]
+10 -5
View File
@@ -170,29 +170,34 @@ class TestIds:
waldo = model.createIfcSlab(Name="Waldo")
run("Optional specifications may still pass if nothing is applicable", specs, model, True)
specs = ids.Ids(title="Title")
spec = ids.Specification(name="Name")
spec.applicability.append(ids.Entity(name="IFCWALL"))
spec.applicability.append(ids.Attribute(name="Name", value="Waldo"))
specs.specifications.append(spec)
spec.set_usage("prohibited")
model = ifcopenshell.file()
wall = model.createIfcSlab(Name="Waldo")
run("Prohibited specifications fail if at least one entity passes all requirements 1/3", specs, model, True)
run("Prohibited specifications fail if at least one entity is applicable 1/3", specs, model, True)
model = ifcopenshell.file()
wall = model.createIfcWall(Name="Wally")
run(
"Prohibited specifications fail if at least one entity passes all requirements 2/3",
"Prohibited specifications fail if at least one entity is applicable 2/3",
specs,
model,
True,
[wall],
[],
[],
)
model = ifcopenshell.file()
wall = model.createIfcWall(Name="Waldo")
run(
"Prohibited specifications fail if at least one entity passes all requirements 3/3",
"Prohibited specifications fail if at least one entity is applicable 3/3",
specs,
model,
False,
[wall],
[wall],
[],
)
spec.set_usage("optional")