test: adapt existing suites to unconditional core, drop dead detector tests

This commit is contained in:
2026-09-30 03:08:13 +03:00
parent 7dc2ec79d1
commit 8172ba2541
6 changed files with 103 additions and 320 deletions
+24 -24
View File
@@ -82,9 +82,9 @@ def _test_positive_values(component, W, component_name="Component"):
f"W range: [{W_arr.min():.3f}, {W_arr.max():.3f}], "
f"result range: [{np.nanmin(result):.6f}, {np.nanmax(result):.6f}]"
)
assert not np.any(np.isinf(result)), (
f"{component_name}: Inf values found in output."
)
assert not np.any(
np.isinf(result)
), f"{component_name}: Inf values found in output."
assert np.all(result > 0), (
f"{component_name}: non-positive values found. "
f"Min = {np.min(result):.10f} at W = {W_arr[np.argmin(result)][0]:.4f}"
@@ -108,21 +108,21 @@ def _test_non_negative_values(
W_arr = np.asarray(W, dtype=float)
result = component(W_arr)
assert not np.any(np.isnan(result)), (
f"{component_name}: NaN values found in output."
)
assert not np.any(np.isinf(result)), (
f"{component_name}: Inf values found in output."
)
assert not np.any(
np.isnan(result)
), f"{component_name}: NaN values found in output."
assert not np.any(
np.isinf(result)
), f"{component_name}: Inf values found in output."
if allow_zero:
assert np.all(result >= 0), (
f"{component_name}: negative values found. Min = {np.min(result):.10f}"
)
assert np.all(
result >= 0
), f"{component_name}: negative values found. Min = {np.min(result):.10f}"
else:
assert np.all(result > 0), (
f"{component_name}: non-positive values found. Min = {np.min(result):.10f}"
)
assert np.all(
result > 0
), f"{component_name}: non-positive values found. Min = {np.min(result):.10f}"
# ---------------------------------------------------------------------------
@@ -136,12 +136,12 @@ def _test_output_shape_preserved(component, W, component_name="Component"):
W_arr = np.asarray(W, dtype=float)
result = component(W_arr)
assert isinstance(result, np.ndarray), (
f"{component_name}: output is {type(result)}, expected np.ndarray"
)
assert result.shape == W_arr.shape, (
f"{component_name}: shape mismatch. Input {W_arr.shape} → Output {result.shape}"
)
assert isinstance(
result, np.ndarray
), f"{component_name}: output is {type(result)}, expected np.ndarray"
assert (
result.shape == W_arr.shape
), f"{component_name}: shape mismatch. Input {W_arr.shape} → Output {result.shape}"
@pytest.mark.quality
@@ -214,9 +214,9 @@ def _test_output_is_ndarray(component, W, component_name="Component"):
W_arr = np.asarray(W, dtype=float)
result = component(W_arr)
assert isinstance(result, np.ndarray), (
f"{component_name}: output type is {type(result).__name__}, expected np.ndarray"
)
assert isinstance(
result, np.ndarray
), f"{component_name}: output type is {type(result).__name__}, expected np.ndarray"
# ---------------------------------------------------------------------------