Fix bug where migrating length units didn't change properties. Unit utility for checking attribute types now considers select types too

Changing properties is very critical for IFC2X3 georeferencing which is stored in a pset.
This commit is contained in:
Dion Moult
2024-06-29 17:04:27 +10:00
parent 2129350ab7
commit 0d401c9272
2 changed files with 32 additions and 2 deletions
@@ -82,3 +82,13 @@ class TestFormatLength(test.bootstrap.IFC4):
assert (
subject.format_length(25.23, 4, unit_system="imperial", input_unit="inch", output_unit="inch") == '25 1/4"'
)
class TestIsAttrType(test.bootstrap.IFC4):
def test_run(self):
schema = ifcopenshell.schema_by_name("IFC4")
declaration = schema.declaration_by_name("IfcPropertySingleValue")
nominal_value = declaration.attribute_by_index(2).type_of_attribute()
assert subject.is_attr_type(nominal_value, "IfcValue")
assert subject.is_attr_type(nominal_value, "IfcLengthMeasure")
assert not subject.is_attr_type(nominal_value, "IfcLengthMeasure", include_select_types=False)