mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 14:23:53 +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 []:
|
for prop in properties or []:
|
||||||
if prop.Name != name:
|
if prop.Name != name:
|
||||||
continue
|
continue
|
||||||
|
is_single_value = False # For now we pass value type only for single values.
|
||||||
if prop.is_a("IfcPropertySingleValue"):
|
if prop.is_a("IfcPropertySingleValue"):
|
||||||
# 2 IfcPropertySingleValue.NominalValue
|
# 2 IfcPropertySingleValue.NominalValue
|
||||||
result = v.wrappedValue if (v := prop[2]) else None
|
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"):
|
elif prop.is_a("IfcPropertyEnumeratedValue"):
|
||||||
# 2 IfcPropertyEnumeratedValue.EnumerationValues
|
# 2 IfcPropertyEnumeratedValue.EnumerationValues
|
||||||
result = [v.wrappedValue for v in values] if (values := prop[2]) else None
|
result = [v.wrappedValue for v in values] if (values := prop[2]) else None
|
||||||
@@ -355,6 +358,8 @@ def get_property(
|
|||||||
result = data
|
result = data
|
||||||
if verbose:
|
if verbose:
|
||||||
result = {"id": prop.id(), "class": prop.is_a(), "value": result}
|
result = {"id": prop.id(), "class": prop.is_a(), "value": result}
|
||||||
|
if is_single_value:
|
||||||
|
result["value_type"] = result_type
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ class TestGetPsetIFC4(test.bootstrap.IFC4):
|
|||||||
"id": 4,
|
"id": 4,
|
||||||
"class": "IfcPropertySingleValue",
|
"class": "IfcPropertySingleValue",
|
||||||
"value": "b",
|
"value": "b",
|
||||||
|
"value_type": "IfcLabel",
|
||||||
}
|
}
|
||||||
|
|
||||||
def test_getting_the_psets_of_a_product_type_as_a_dictionary(self):
|
def test_getting_the_psets_of_a_product_type_as_a_dictionary(self):
|
||||||
@@ -66,6 +67,7 @@ class TestGetPsetIFC4(test.bootstrap.IFC4):
|
|||||||
"id": 3,
|
"id": 3,
|
||||||
"class": "IfcPropertySingleValue",
|
"class": "IfcPropertySingleValue",
|
||||||
"value": "y",
|
"value": "y",
|
||||||
|
"value_type": "IfcLabel",
|
||||||
},
|
},
|
||||||
"id": pset.id(),
|
"id": pset.id(),
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user