fix bim tests after changes in quantities calculations

This commit is contained in:
Andrej730
2024-07-31 13:05:23 +05:00
parent 159355d63a
commit a24bb069aa
4 changed files with 10 additions and 11 deletions
+1 -1
View File
@@ -377,7 +377,7 @@ Scenario: Assign cost item quantity - quantity based
And I press "bim.assign_class"
And the object "IfcWall/Cube" is selected
And I press "bim.add_qto(obj='IfcWall/Cube', obj_type='Object')"
And I press "bim.calculate_all_quantities"
And I press "bim.perform_quantity_take_off"
When I press "bim.assign_cost_item_quantity(cost_item={cost_item}, related_object_type='PRODUCT', prop_name='NetVolume')"
Then nothing happens
+3 -3
View File
@@ -380,15 +380,15 @@ Scenario: Edit pset length property
Scenario: Edit qset length property
Given an empty IFC project
And I press "mesh.add_clever_stair"
And I press "bim.calculate_all_quantities"
And I press "bim.perform_quantity_take_off"
And the variable "pset" is "tool.Pset.get_element_pset(tool.Ifc.get_entity(bpy.context.active_object), 'Qto_StairFlightBaseQuantities').id()"
And the variable "si_conversion" is "ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get())"
And I press "bim.enable_pset_editing(pset_id={pset}, obj='IfcStairFlight/StairFlight', obj_type='Object')"
# Testing Q_LENGTH type of prop
Then "active_object.PsetProperties.properties['Length'].metadata.special_type" is "LENGTH"
And "active_object.PsetProperties.properties['Length'].metadata.float_value" is roughly "2492.57397"
And "active_object.PsetProperties.properties['Length'].metadata.length_value" is roughly "2.49257"
And "active_object.PsetProperties.properties['Length'].metadata.float_value" is roughly "2156.485"
And "active_object.PsetProperties.properties['Length'].metadata.length_value" is roughly "2.156"
When I set "active_object.PsetProperties.properties['Length'].metadata.float_value" to "350"
Then "active_object.PsetProperties.properties['Length'].metadata.length_value" is roughly "0.35"
+3 -4
View File
@@ -60,9 +60,8 @@ Scenario: Calculate all quantities
And I add a cube
And the object "Cube" is selected
And I press "bim.assign_class(ifc_class='IfcWall', predefined_type='SOLIDWALL')"
When I press "bim.calculate_all_quantities"
When I press "bim.perform_quantity_take_off"
And the variable "qset_id" is "{ifc}.by_type('IfcElementQuantity')[0].id()"
And I press "bim.enable_pset_editing(pset_id={qset_id}, obj='IfcWall/Cube', obj_type='Object')"
And I press "bim.disable_pset_editing(obj='IfcWall/Cube', obj_type='Object')"
Then "active_object.PsetProperties.qto_name" is "Qto_WallBaseQuantities"
Then "active_object.PsetProperties.properties['Length'].metadata.float_value" is "2000.0"
Then "active_object.PsetProperties.active_pset_name" is "Qto_WallBaseQuantities"
And "active_object.PsetProperties.properties['Length'].metadata.float_value" is roughly "2000.0"
+3 -3
View File
@@ -684,17 +684,17 @@ def prop_is_roughly_value(prop, value):
value = replace_variables(value)
is_value = False
try:
exec(f'assert round(bpy.context.{prop}, 5) == "{value}"')
exec(f'assert round(bpy.context.{prop}, 3) == "{value}"')
is_value = True
except:
try:
exec(f"assert round(bpy.context.{prop}, 5) == {value}")
exec(f"assert round(bpy.context.{prop}, 3) == {value}")
is_value = True
except:
pass
if not is_value:
print(f"bpy.context.{prop}")
actual_value = round(eval(f"bpy.context.{prop}"), 5)
actual_value = round(eval(f"bpy.context.{prop}"), 3)
assert False, f"Value is {actual_value}"