Minor fixes to IfcTester testcases

This commit is contained in:
Dion Moult
2022-10-07 13:34:19 +11:00
parent 1677a6c83f
commit 27dc81544c
3 changed files with 8 additions and 7 deletions
+1 -1
View File
@@ -79,7 +79,7 @@ class FacetDocGenerator:
# the entity type passed to us in `inst`. # the entity type passed to us in `inst`.
specs = ids.Ids(title=name) specs = ids.Ids(title=name)
spec = ids.Specification(name=name) spec = ids.Specification(name=name)
spec.applicability.append(ids.Entity(name=inst.is_a())) spec.applicability.append(ids.Entity(name=inst.is_a().upper()))
spec.requirements.append(facet) spec.requirements.append(facet)
specs.specifications.append(spec) specs.specifications.append(spec)
+5 -5
View File
@@ -699,15 +699,15 @@ class TestClassification:
project = ifc.createIfcProject() project = ifc.createIfcProject()
system_a = ifcopenshell.api.run("classification.add_classification", ifc, classification=system_a) system_a = ifcopenshell.api.run("classification.add_classification", ifc, classification=system_a)
element0 = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall") element0 = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall")
element1 = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall") element1 = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcSlab")
ifcopenshell.api.run( ifcopenshell.api.run(
"classification.add_reference", ifc, product=element1, reference=ref1, classification=system_a "classification.add_reference", ifc, product=element1, reference=ref1, classification=system_a
) )
element11 = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall") element11 = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcColumn")
ifcopenshell.api.run( ifcopenshell.api.run(
"classification.add_reference", ifc, product=element11, reference=ref11, classification=system_a "classification.add_reference", ifc, product=element11, reference=ref11, classification=system_a
) )
element22 = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall") element22 = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcBeam")
ifcopenshell.api.run( ifcopenshell.api.run(
"classification.add_reference", "classification.add_reference",
ifc, ifc,
@@ -738,9 +738,9 @@ class TestClassification:
run("A required facet checks all parameters as normal", facet=facet, inst=element1, expected=True) run("A required facet checks all parameters as normal", facet=facet, inst=element1, expected=True)
facet = Classification(minOccurs=0, maxOccurs=0) facet = Classification(minOccurs=0, maxOccurs=0)
run("A prohibited facet returns the opposite of a required facet", facet=facet, inst=element1, expected=False) run("A prohibited facet returns the opposite of a required facet", facet=facet, inst=element1, expected=False)
facet = Attribute(name="Name", minOccurs=0) facet = Classification(minOccurs=0)
run("An optional facet always passes regardless of outcome 1/2", facet=facet, inst=element0, expected=True) run("An optional facet always passes regardless of outcome 1/2", facet=facet, inst=element0, expected=True)
facet = Attribute(name="Rabbit", minOccurs=0) facet = Classification(minOccurs=0)
run("An optional facet always passes regardless of outcome 2/2", facet=facet, inst=element1, expected=True) run("An optional facet always passes regardless of outcome 2/2", facet=facet, inst=element1, expected=True)
facet = Classification(value="1") facet = Classification(value="1")
+2 -1
View File
@@ -118,7 +118,7 @@ class TestIds:
wall.Name = "Waldo" wall.Name = "Waldo"
run("A minimal IDS can check a minimal IFC 2/2", specs, model, True, [wall, waldo], []) run("A minimal IDS can check a minimal IFC 2/2", specs, model, True, [wall, waldo], [])
spec.ifcVersion = [] spec.ifcVersion = ["IFC2X3"]
run( run(
"Specification version is purely metadata and does not impact pass or fail result", "Specification version is purely metadata and does not impact pass or fail result",
specs, specs,
@@ -127,6 +127,7 @@ class TestIds:
[wall, waldo], [wall, waldo],
) )
spec.ifcVersion = []
spec.minOccurs = 1 spec.minOccurs = 1
model = ifcopenshell.file() model = ifcopenshell.file()
waldo = model.createIfcWall(Name="Waldo") waldo = model.createIfcWall(Name="Waldo")