mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-27 10:51:13 +00:00
Minor IfcTester test case fixes
This commit is contained in:
@@ -111,10 +111,14 @@ class IdsDocGenerator:
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.testcases = []
|
self.testcases = []
|
||||||
|
|
||||||
def __call__(self, name, ids, ifc, expected, applicable_entities=[], failed_entities=[]):
|
def __call__(self, name, ids, ifc, expected, applicable_entities=None, failed_entities=None):
|
||||||
ids.validate(ifc)
|
ids.validate(ifc)
|
||||||
all_applicable = set()
|
all_applicable = set()
|
||||||
all_failures = set()
|
all_failures = set()
|
||||||
|
if not applicable_entities:
|
||||||
|
applicable_entities = []
|
||||||
|
if not failed_entities:
|
||||||
|
failed_entities = []
|
||||||
for spec in ids.specifications:
|
for spec in ids.specifications:
|
||||||
assert spec.status is expected
|
assert spec.status is expected
|
||||||
all_applicable.update(spec.applicable_entities)
|
all_applicable.update(spec.applicable_entities)
|
||||||
|
|||||||
@@ -1541,6 +1541,7 @@ class TestPartOf:
|
|||||||
facet = PartOf(relation="IfcRelNests", entity="IFCFURNITURE")
|
facet = PartOf(relation="IfcRelNests", entity="IFCFURNITURE")
|
||||||
run("The nest entity must match exactly 2/2", facet=facet, inst=subelement, expected=True)
|
run("The nest entity must match exactly 2/2", facet=facet, inst=subelement, expected=True)
|
||||||
|
|
||||||
|
element.PredefinedType = "USERDEFINED"
|
||||||
element.ObjectType = "WATERBOTTLE"
|
element.ObjectType = "WATERBOTTLE"
|
||||||
facet = PartOf(relation="IfcRelNests", entity="IFCFURNITURE", predefinedType="LITTERBOX")
|
facet = PartOf(relation="IfcRelNests", entity="IFCFURNITURE", predefinedType="LITTERBOX")
|
||||||
run("The nest predefined type must match exactly 1/2", facet=facet, inst=subelement, expected=False)
|
run("The nest predefined type must match exactly 1/2", facet=facet, inst=subelement, expected=False)
|
||||||
|
|||||||
@@ -23,12 +23,22 @@ import ifcopenshell
|
|||||||
from ifctester import ids
|
from ifctester import ids
|
||||||
|
|
||||||
|
|
||||||
def run(name, specs, model, expected, applicable_entities, failed_entities):
|
def run(name, ids, ifc, expected, applicable_entities=None, failed_entities=None):
|
||||||
specs.validate(model)
|
ids.validate(ifc)
|
||||||
spec = specs.specifications[0]
|
all_applicable = set()
|
||||||
assert spec.status is expected
|
all_failures = set()
|
||||||
assert set(spec.applicable_entities) == set(applicable_entities)
|
if not applicable_entities:
|
||||||
assert set(spec.requirements[0].failed_entities) == set(failed_entities)
|
applicable_entities = []
|
||||||
|
if not failed_entities:
|
||||||
|
failed_entities = []
|
||||||
|
for spec in ids.specifications:
|
||||||
|
assert spec.status is expected
|
||||||
|
all_applicable.update(spec.applicable_entities)
|
||||||
|
for requirement in spec.requirements:
|
||||||
|
if requirement.status is False:
|
||||||
|
all_failures.update(requirement.failed_entities)
|
||||||
|
assert set(all_applicable) == set(applicable_entities)
|
||||||
|
assert set(all_failures) == set(failed_entities)
|
||||||
|
|
||||||
|
|
||||||
class TestIds:
|
class TestIds:
|
||||||
@@ -116,7 +126,7 @@ class TestIds:
|
|||||||
waldo = model.createIfcWall(Name="Waldo")
|
waldo = model.createIfcWall(Name="Waldo")
|
||||||
run("A minimal IDS can check a minimal IFC 1/2", specs, model, False, [wall, waldo], [wall])
|
run("A minimal IDS can check a minimal IFC 1/2", specs, model, False, [wall, waldo], [wall])
|
||||||
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 = ["IFC2X3"]
|
spec.ifcVersion = ["IFC2X3"]
|
||||||
run(
|
run(
|
||||||
@@ -124,7 +134,7 @@ class TestIds:
|
|||||||
specs,
|
specs,
|
||||||
model,
|
model,
|
||||||
True,
|
True,
|
||||||
[wall, waldo],
|
[wall, waldo]
|
||||||
)
|
)
|
||||||
|
|
||||||
spec.ifcVersion = []
|
spec.ifcVersion = []
|
||||||
|
|||||||
Reference in New Issue
Block a user