mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
Fix get_pset tests after 832ad6d31
This commit is contained in:
@@ -333,9 +333,12 @@ def get_property(
|
||||
for prop in properties or []:
|
||||
if prop.Name != name:
|
||||
continue
|
||||
is_single_value = False # For now we pass value type only for single values.
|
||||
if prop.is_a("IfcPropertySingleValue"):
|
||||
# 2 IfcPropertySingleValue.NominalValue
|
||||
result = v.wrappedValue if (v := prop[2]) else None
|
||||
result_type = v.is_a() if v else None
|
||||
is_single_value = True
|
||||
elif prop.is_a("IfcPropertyEnumeratedValue"):
|
||||
# 2 IfcPropertyEnumeratedValue.EnumerationValues
|
||||
result = [v.wrappedValue for v in values] if (values := prop[2]) else None
|
||||
@@ -355,6 +358,8 @@ def get_property(
|
||||
result = data
|
||||
if verbose:
|
||||
result = {"id": prop.id(), "class": prop.is_a(), "value": result}
|
||||
if is_single_value:
|
||||
result["value_type"] = result_type
|
||||
return result
|
||||
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ class TestGetPsetIFC4(test.bootstrap.IFC4):
|
||||
"id": 4,
|
||||
"class": "IfcPropertySingleValue",
|
||||
"value": "b",
|
||||
"value_type": "IfcLabel",
|
||||
}
|
||||
|
||||
def test_getting_the_psets_of_a_product_type_as_a_dictionary(self):
|
||||
@@ -66,6 +67,7 @@ class TestGetPsetIFC4(test.bootstrap.IFC4):
|
||||
"id": 3,
|
||||
"class": "IfcPropertySingleValue",
|
||||
"value": "y",
|
||||
"value_type": "IfcLabel",
|
||||
},
|
||||
"id": pset.id(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user