Mentions légales du service

Skip to content
Snippets Groups Projects
Verified Commit 48d18343 authored by ANDREY Paul's avatar ANDREY Paul
Browse files

Add some 'pragma: no cover' for deprecated functions and edge-case exception handling.

parent 6a18057c
No related branches found
No related tags found
1 merge request!57Improve tests coverage and fix test-digged bugs
......@@ -127,7 +127,7 @@ class Aggregator(metaclass=ABCMeta):
self,
) -> Dict[str, Any]:
"""Return a JSON-serializable dict with this object's parameters."""
return {}
return {} # pragma: no cover
@classmethod
def from_config(
......
......@@ -69,11 +69,9 @@ from ._build import (
# Concrete implementations using various protocols:
try:
from . import grpc
except ImportError:
# pragma: no cover
except ImportError: # pragma: no cover
_INSTALLABLE_BACKENDS["grpc"] = ("grpcio", "protobuf")
try:
from . import websockets
except ImportError:
# pragma: no cover
except ImportError: # pragma: no cover
_INSTALLABLE_BACKENDS["websockets"] = ("websockets",)
......@@ -48,7 +48,7 @@ def raise_if_installable(
exc: Optional[Exception] = None,
) -> None:
"""Raise a RuntimeError if a given protocol is missing but installable."""
if protocol in _INSTALLABLE_BACKENDS:
if protocol in _INSTALLABLE_BACKENDS: # pragma: no cover
raise RuntimeError(
f"The '{protocol}' communication protocol network endpoints "
"could not be imported, but could be installed by satisfying "
......@@ -95,7 +95,7 @@ def build_client(
protocol = protocol.strip().lower()
try:
cls = access_registered(name=protocol, group="NetworkClient")
except KeyError as exc:
except KeyError as exc: # pragma: no cover
raise_if_installable(protocol, exc)
raise KeyError(
"Failed to retrieve NetworkClient "
......@@ -153,7 +153,7 @@ def build_server(
protocol = protocol.strip().lower()
try:
cls = access_registered(name=protocol, group="NetworkServer")
except KeyError as exc:
except KeyError as exc: # pragma: no cover
raise_if_installable(protocol, exc)
raise KeyError(
"Failed to retrieve NetworkServer "
......
......@@ -159,7 +159,7 @@ class NbSamplesField(DataInfoField):
@register_data_info_field
class InputShapeField(DataInfoField):
class InputShapeField(DataInfoField): # pragma: no cover
"""Specifications for 'input_shape' data_info field."""
field = "input_shape"
......@@ -216,7 +216,7 @@ class InputShapeField(DataInfoField):
@register_data_info_field
class NbFeaturesField(DataInfoField):
class NbFeaturesField(DataInfoField): # pragma: no cover
"""Deprecated specifications for 'n_features' data_info field."""
field = "n_features"
......
......@@ -220,7 +220,7 @@ class InMemoryDataset(Dataset):
)
@staticmethod
def load_data_array(
def load_data_array( # pragma: no cover
path: str,
**kwargs: Any,
) -> DataArray:
......@@ -241,7 +241,7 @@ class InMemoryDataset(Dataset):
return load_data_array(path, **kwargs)
@staticmethod
def save_data_array(
def save_data_array( # pragma: no cover
path: str,
array: Union[DataArray, pd.Series],
) -> str:
......
......@@ -347,7 +347,9 @@ class Metric(metaclass=ABCMeta):
return s_wght
@staticmethod
def normalize_weights(s_wght: np.ndarray) -> np.ndarray:
def normalize_weights( # pragma: no cover
s_wght: np.ndarray,
) -> np.ndarray:
"""Utility method to ensure weights sum to one.
Note that this method may or may not be used depending on
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment