test: adapt existing suites to unconditional core, drop dead detector tests
This commit is contained in:
@@ -10,7 +10,6 @@ seconds to complete. They are intended for CI/full test runs, not for
|
||||
fast feedback during development.
|
||||
"""
|
||||
|
||||
|
||||
import numpy as np
|
||||
from hypothesis import given, settings, strategies as st
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user