docs: update documentation files and fix linting issues

This commit is contained in:
2026-07-07 13:32:48 +03:00
parent 9bf1e1333e
commit be3e288e0d
27 changed files with 423 additions and 250 deletions
+21 -26
View File
@@ -36,54 +36,49 @@ import pytest
@pytest.mark.api
def _test_component_is_callable(component, component_name="Component"):
"""Component must be callable with array input."""
assert callable(component), (
f"{component_name}: component is not callable"
)
assert callable(component), f"{component_name}: component is not callable"
W = np.array([1.5, 2.0, 3.0])
result = component(W)
assert isinstance(result, np.ndarray), (
f"{component_name}: __call__ returned {type(result)}, "
f"expected np.ndarray"
)
assert result.shape == W.shape, (
f"{component_name}: shape mismatch {W.shape} → {result.shape}"
f"{component_name}: __call__ returned {type(result)}, " f"expected np.ndarray"
)
assert (
result.shape == W.shape
), f"{component_name}: shape mismatch {W.shape} → {result.shape}"
@pytest.mark.api
def _test_component_repr(component, component_name="Component"):
"""Component must have a non-empty repr."""
repr_str = repr(component)
assert isinstance(repr_str, str), (
f"{component_name}: repr returned {type(repr_str)}"
)
assert len(repr_str) > 0, (
f"{component_name}: repr is empty string"
)
assert isinstance(
repr_str, str
), f"{component_name}: repr returned {type(repr_str)}"
assert len(repr_str) > 0, f"{component_name}: repr is empty string"
# repr should contain the class name
assert component_name in repr_str or component.__class__.__name__ in repr_str, (
f"{component_name}: repr should contain class name. Got: {repr_str}"
)
assert (
component_name in repr_str or component.__class__.__name__ in repr_str
), f"{component_name}: repr should contain class name. Got: {repr_str}"
@pytest.mark.api
def _test_component_list_input(component, component_name="Component"):
"""Component must handle Python list input (numpy converts it)."""
result = component([1.5, 2.0, 3.0])
assert isinstance(result, np.ndarray), (
f"{component_name}: list input returned {type(result)}"
)
assert isinstance(
result, np.ndarray
), f"{component_name}: list input returned {type(result)}"
@pytest.mark.api
def _test_component_empty_input(component, component_name="Component"):
"""Component must handle empty array input gracefully."""
result = component(np.array([]))
assert isinstance(result, np.ndarray), (
f"{component_name}: empty input returned {type(result)}"
)
assert result.shape == (0,), (
f"{component_name}: empty input should return empty array"
)
assert isinstance(
result, np.ndarray
), f"{component_name}: empty input returned {type(result)}"
assert result.shape == (
0,
), f"{component_name}: empty input should return empty array"