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:
@@ -1,10 +1,9 @@
|
||||
"""Contracts for smooth depth volume, editable presets and normal masks."""
|
||||
from collections import Counter
|
||||
import bpy
|
||||
import numpy as np
|
||||
import pytest
|
||||
|
||||
from tools.nodes.groups.image_depth_cutout import build_image_depth_cutout_group, build_volume_fields
|
||||
from tools.nodes.groups.image_depth_cutout import build_volume_fields
|
||||
from anyimage.common.object import modifier_input_identifier, set_modifier_input
|
||||
|
||||
|
||||
@@ -104,7 +103,6 @@ def set_test_structure(monkeypatch, value):
|
||||
|
||||
|
||||
def test_shell_thickness_extends_behind_the_tilted_front():
|
||||
from scipy.spatial import cKDTree
|
||||
from tests.support.depth_surface import surface, evaluated, assert_closed
|
||||
obj, set_value = surface(step=0, resolution=4)
|
||||
image = bpy.data.images["Camera"]
|
||||
@@ -210,15 +208,6 @@ def test_depth_cutout_normal_reduction_uses_point_domain():
|
||||
evaluated.to_mesh_clear()
|
||||
|
||||
|
||||
def test_depth_cutout_reuses_boundary_and_slow_field_nodes():
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
group = build_image_depth_cutout_group()
|
||||
counts = Counter(node.bl_idname for node in group.nodes)
|
||||
assert counts["GeometryNodeInputMeshEdgeNeighbors"] <= 15
|
||||
# 内部平滑、边界条带与 pin sharp 的法线相干度各一个 Blur。
|
||||
assert counts["GeometryNodeBlurAttribute"] <= 13
|
||||
|
||||
|
||||
def test_center_derives_from_shared_slow_fields():
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
points = [(x, y) for y in range(3) for x in range(3)]
|
||||
@@ -264,7 +253,7 @@ def test_zero_thickness_short_circuits_shell_without_warnings():
|
||||
assert len(faces) == len(obj.data.polygons)
|
||||
modifier = obj.modifiers[0]
|
||||
result = obj.evaluated_get(bpy.context.evaluated_depsgraph_get())
|
||||
mesh = result.to_mesh()
|
||||
result.to_mesh()
|
||||
try:
|
||||
assert not list(modifier.node_warnings), [
|
||||
warning.message for warning in modifier.node_warnings
|
||||
@@ -274,8 +263,7 @@ def test_zero_thickness_short_circuits_shell_without_warnings():
|
||||
|
||||
|
||||
@pytest.mark.parametrize("thickness,inflation", [
|
||||
(0.0, 1.0), (0.02, 0.0), (0.02, 0.0001),
|
||||
(0.02, 0.5), (0.1, 0.5), (0.1, 1.0),
|
||||
(0.0, 1.0), (0.02, 0.5), (0.1, 1.0),
|
||||
])
|
||||
def test_shell_ignores_front_inflation(thickness, inflation):
|
||||
from tests.support.depth_surface import surface, evaluated, assert_closed
|
||||
|
||||
Reference in New Issue
Block a user