Files
IfcOpenShell/src/ifcopenshell-python/test/fixtures/rules/generate_26.py
T
Andrej730 44ce7c7e8a rules fixture: nornallize headers
- to avoid some diffs on regeneration
- some fixtures had problems with the header, so `fail` for them wasn't
really testing the intended case, because small issues in the header
would make fixture fail regardless
2026-08-03 16:54:22 +05:00

21 lines
704 B
Python

import ifcopenshell
from generate import normalize_header
cases = (
("pass", "label-values", ("test1", "test2")),
("pass", "nil-values", None),
("fail", "distinct-value-types", ("test1", 2)),
)
for result, name, values in cases:
ifc_file = ifcopenshell.file(schema="IFC4X3")
list_values = None
if values is not None:
list_values = [
ifc_file.create_entity("IfcInteger", v) if isinstance(v, int) else ifc_file.create_entity("IfcLabel", v)
for v in values
]
ifc_file.create_entity("IfcPropertyListValue", Name="Test", ListValues=list_values)
normalize_header(ifc_file)
ifc_file.write(f"{result}-property-list-value-{name}.ifc")