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:
@@ -98,23 +98,6 @@ def test_cutout_crop_bounds_map_to_the_source_plane():
|
||||
|
||||
np.testing.assert_allclose(bounds, (-0.5, 0.5, -0.25, 0.25))
|
||||
|
||||
|
||||
def test_depth_surface_cutout_uses_default_alpha_boundary():
|
||||
alpha = np.zeros((12, 16), dtype=np.float32)
|
||||
alpha[2:10, 2:14] = 0.89
|
||||
alpha[4:8, 5:11] = 0.91
|
||||
|
||||
selection_contours = cutout_geometry.extract_cutout_contours(
|
||||
alpha,
|
||||
64,
|
||||
)
|
||||
contour = np.asarray(selection_contours.components[0][0])
|
||||
|
||||
assert selection_contours.image_size == (16, 12)
|
||||
np.testing.assert_allclose(contour.min(axis=0), (5.0, 4.0))
|
||||
np.testing.assert_allclose(contour.max(axis=0), (11.0, 8.0))
|
||||
|
||||
|
||||
def test_cutout_reference_mask_resamples_content_to_depth_resolution():
|
||||
content = np.zeros((4, 4), dtype=np.float32)
|
||||
content[:, 2:] = 1.0
|
||||
@@ -149,21 +132,6 @@ def test_blender_cutout_alpha_pipeline_does_not_import_pillow():
|
||||
assert selection_contours.components
|
||||
assert np.any((antialiased > 0.0) & (antialiased < 1.0))
|
||||
|
||||
|
||||
def test_blender_cutout_contour_resolution_tracks_sampling_resolution():
|
||||
expected = SelectionContours(
|
||||
components=(((((0, 0), (1, 0), (0, 1))),),),
|
||||
image_size=(1, 1),
|
||||
)
|
||||
values = SimpleNamespace(shape=(1024, 1024))
|
||||
with patch.object(cutout_geometry, "extract_selection_contours", return_value=expected) as trace:
|
||||
assert cutout_geometry.extract_cutout_contours(values, 32) == expected
|
||||
assert cutout_geometry.extract_cutout_contours(values, 256) == expected
|
||||
|
||||
assert trace.call_args_list[0].kwargs["max_resolution"] == 512
|
||||
assert trace.call_args_list[1].kwargs["max_resolution"] == 1024
|
||||
|
||||
|
||||
def test_cutout_domain_adapts_boundary_spacing_for_a_small_valid_selection():
|
||||
components = ((((2046, 2046), (2050, 2046), (2050, 2050), (2046, 2050)),),)
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
from types import SimpleNamespace
|
||||
from unittest.mock import patch
|
||||
import bpy
|
||||
import numpy as np
|
||||
import pytest
|
||||
from mathutils import Matrix, Vector
|
||||
from mathutils import Vector
|
||||
|
||||
|
||||
from anyimage.common import depth as depth_data
|
||||
|
||||
@@ -287,8 +287,6 @@ class FrameProjectionTest(unittest.TestCase):
|
||||
|
||||
|
||||
def test_frame_keeps_positive_active_origin_as_result_depth_location(self):
|
||||
import numpy as np
|
||||
|
||||
marker = SimpleNamespace(copy=lambda: "active-origin")
|
||||
source = {
|
||||
"object": SimpleNamespace(
|
||||
|
||||
Reference in New Issue
Block a user