mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
Fixed test after c8c0c9a
Taking into account that now we have error messages if user will try to remove the last material layer which would make layer set invalid ifc. FAILED test/bim/test_feature.py::test_remove_material_set_layer - AssertionError: Failed to run operator bpy.ops.bim.remove_layer(layer=IfcStore.get_file().by_id(93).MaterialLayers[...
This commit is contained in:
@@ -435,17 +435,20 @@ Scenario: Remove material set layer
|
||||
And the object "Cube" is selected
|
||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
|
||||
And I press "bim.assign_class"
|
||||
|
||||
And I add an empty
|
||||
And the object "Empty" is selected
|
||||
And I set "scene.BIMRootProperties.ifc_product" to "IfcElementType"
|
||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcWallType"
|
||||
And I press "bim.assign_class"
|
||||
|
||||
And I press "bim.add_material(obj='')"
|
||||
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialLayerSet"
|
||||
And I press "bim.assign_material"
|
||||
|
||||
And I press "bim.enable_editing_assigned_material"
|
||||
And the variable "material_set" is "{ifc}.by_type('IfcMaterialLayerSet')[0].id()"
|
||||
And I press "bim.remove_layer(layer={ifc}.by_id({material_set}).MaterialLayers[0].id())"
|
||||
|
||||
And I press "bim.add_layer(layer_set={material_set})"
|
||||
When I press "bim.remove_layer(layer={ifc}.by_id({material_set}).MaterialLayers[0].id())"
|
||||
Then nothing happens
|
||||
And I press "bim.remove_layer(layer={ifc}.by_id({material_set}).MaterialLayers[0].id())"
|
||||
Then I press "bim.remove_layer(layer={ifc}.by_id({material_set}).MaterialLayers[0].id())" and expect error "Error: At least one layer must exist"
|
||||
|
||||
@@ -159,6 +159,21 @@ def i_add_a_plane_of_size_size_at_location(size, location):
|
||||
bpy.ops.mesh.primitive_plane_add(size=float(size), location=[float(co) for co in location.split(",")])
|
||||
|
||||
|
||||
@then(parsers.parse('I press "{operator}" and expect error "{error_msg}"'))
|
||||
def i_press_operator_and_expect_error(operator, error_msg):
|
||||
operator = replace_variables(operator)
|
||||
try:
|
||||
if "(" in operator:
|
||||
exec(f"bpy.ops.{operator}")
|
||||
else:
|
||||
exec(f"bpy.ops.{operator}()")
|
||||
assert False, f"Operator bpy.ops.{operator} ran without exception '{error_msg}'"
|
||||
except Exception as e:
|
||||
actual_error_msg = str(e).strip()
|
||||
if str(e).strip() != error_msg:
|
||||
traceback.print_exc()
|
||||
assert False, f"Got different exception running bpy.ops.{operator} - '{actual_error_msg}' instead of '{error_msg}'"
|
||||
|
||||
@given(parsers.parse('I press "{operator}"'))
|
||||
@when(parsers.parse('I press "{operator}"'))
|
||||
def i_press_operator(operator):
|
||||
|
||||
Reference in New Issue
Block a user