MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / run

Function run

src/ifctester/test/test_ids.py:30–52  ·  view source on GitHub ↗
(
    name: str,
    ids: ids.Ids,
    ifc: ifcopenshell.file,
    expected: bool,
    applicable_entities: Optional[list[ifcopenshell.entity_instance]] = None,
    failed_entities: Optional[list[ifcopenshell.entity_instance]] = None,
)

Source from the content-addressed store, hash-verified

28
29
30def run(
31 name: str,
32 ids: ids.Ids,
33 ifc: ifcopenshell.file,
34 expected: bool,
35 applicable_entities: Optional[list[ifcopenshell.entity_instance]] = None,
36 failed_entities: Optional[list[ifcopenshell.entity_instance]] = None,
37):
38 ids.validate(ifc)
39 all_applicable = set()
40 all_failures = set()
41 if not applicable_entities:
42 applicable_entities = []
43 if not failed_entities:
44 failed_entities = []
45 for spec in ids.specifications:
46 assert spec.status is expected
47 all_applicable.update(spec.applicable_entities)
48 for requirement in spec.requirements:
49 if requirement.status is False:
50 all_failures.update([f["element"] for f in requirement.failures])
51 assert set(all_applicable) == set(applicable_entities)
52 assert set(all_failures) == set(failed_entities)
53
54
55class TestIds:

Calls 3

setFunction · 0.50
validateMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected