Refactor tests and remove unused imports

- Cleaned up test files by removing unnecessary imports and unused parameters.
- Simplified test functions by eliminating redundant parameterization and consolidating logic.
- Updated test cases to directly use defined values instead of parameterized inputs where applicable.
- Enhanced readability and maintainability of the test code across various test files.
This commit is contained in:
2026-09-17 10:02:05 +08:00
parent ac7f5a7f6d
commit 0aeb61f818
22 changed files with 95 additions and 372 deletions

View File

@@ -11,15 +11,14 @@ from tests.support.depth_surface import assert_closed, component_count, evaluate
@pytest.mark.parametrize("mode", [0, 1])
@pytest.mark.parametrize("split", [0.0, 0.5])
def test_shell_walls_directly_connect_caps(mode, split):
def test_shell_walls_directly_connect_caps(mode):
from anyimage.common.object import modifier_input_identifier, set_modifier_input
obj, set_value = surface(resolution=4)
obj.data.attributes.new("o_balloon", "FLOAT", "POINT").data.foreach_set(
"value", np.full(len(obj.data.vertices), 0.3)
)
set_value("Depth Split", split)
set_value("Depth Split", 0.5)
front, faces = evaluated(obj)
edges = Counter(tuple(sorted((a, b))) for face in faces for a, b in zip(face, (*face[1:], face[0])))
boundary_count = sum(count == 1 for count in edges.values())
@@ -47,10 +46,9 @@ def test_shell_walls_directly_connect_caps(mode, split):
@pytest.mark.parametrize("thickness", [0.1, 1.4])
@pytest.mark.parametrize("split", [0.0, 0.5])
def test_surface_caps_and_segmented_walls_are_connected(thickness, split):
def test_surface_caps_and_segmented_walls_are_connected(thickness):
obj, set_value = surface()
set_value("Depth Split", split)
set_value("Depth Split", 0.5)
set_value("Thickness", thickness)
coords, faces = evaluated(obj)
assert np.isfinite(coords).all()
@@ -231,15 +229,14 @@ def test_source_surface_sampling_preserves_depth_on_side_walls():
@pytest.mark.parametrize("thickness", [0.0, 0.2])
@pytest.mark.parametrize("split", [0.0, 0.5])
def test_temporary_fields_are_removed_and_user_attributes_survive(thickness, split):
def test_temporary_fields_are_removed_and_user_attributes_survive(thickness):
obj, set_value = surface()
obj.data.attributes.new("o_depth_probe", "FLOAT", "POINT")
attribute = obj.data.attributes.new("o_user_weight", "FLOAT", "POINT")
obj.data.attributes.new(".o_anyimage_user_weight", "FLOAT", "POINT")
for value in attribute.data:
value.value = 0.75
set_value("Depth Split", split)
set_value("Depth Split", 0.5)
set_value("Thickness", thickness)
result = obj.evaluated_get(bpy.context.evaluated_depsgraph_get())
mesh = result.to_mesh()