Skip to content

Commit

Permalink
Added exceptions for coverage of not implemented classes and functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik-Geo committed Oct 17, 2024
1 parent fd8a5dd commit 5f45de8
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 31 deletions.
6 changes: 3 additions & 3 deletions geost/abstract_classes.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from abc import ABC, abstractmethod


class AbstractHeader(ABC):
class AbstractHeader(ABC): # pragma: no cover
@property
@abstractmethod
def gdf(self):
Expand Down Expand Up @@ -63,7 +63,7 @@ def get_area_labels(self):
pass


class AbstractData(ABC):
class AbstractData(ABC): # pragma: no cover
@property
@abstractmethod
def df(self):
Expand Down Expand Up @@ -126,7 +126,7 @@ def to_datafusiontools(self):
pass


class AbstractCollection(ABC):
class AbstractCollection(ABC): # pragma: no cover
@property
@abstractmethod
def header(self):
Expand Down
20 changes: 10 additions & 10 deletions geost/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ def get_area_labels(
return area_labels


class LineHeader(AbstractHeader, GeopandasExportMixin):
class LineHeader(AbstractHeader, GeopandasExportMixin): # pragma: no cover
def __init__(self, gdf, vertical_reference: str | int | CRS):
self.gdf = gdf
self.__vertical_reference = CRS(vertical_reference)
Expand Down Expand Up @@ -1371,28 +1371,28 @@ def select_by_values(

return self.__class__(selected, self.has_inclined)

def slice_depth_interval(self):
def slice_depth_interval(self): # pragma: no cover
raise NotImplementedError()

def slice_by_values(self):
def slice_by_values(self): # pragma: no cover
raise NotImplementedError()

def select_by_condition(self):
def select_by_condition(self): # pragma: no cover
raise NotImplementedError()

def get_cumulative_layer_thickness(self):
def get_cumulative_layer_thickness(self): # pragma: no cover
raise NotImplementedError()

def get_layer_top(self):
def get_layer_top(self): # pragma: no cover
raise NotImplementedError()

def to_vtm(self):
def to_vtm(self): # pragma: no cover
raise NotImplementedError()

def to_datafusiontools(self):
def to_datafusiontools(self): # pragma: no cover
raise NotImplementedError()

def to_multiblock(self):
def to_multiblock(self): # pragma: no cover
raise NotImplementedError()


Expand Down Expand Up @@ -2471,7 +2471,7 @@ def get_layer_top(self):
raise NotImplementedError()


class LogCollection(Collection):
class LogCollection(Collection): # pragma: no cover
def get_cumulative_layer_thickness(self):
raise NotImplementedError()

Expand Down
2 changes: 1 addition & 1 deletion geost/bro/bro_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,5 @@ def from_opendap(
return cls.from_netcdf(url, data_vars, bbox, lazy, **xr_kwargs)


class Regis(LayerModel):
class Regis(LayerModel): # pragma: no cover
pass
24 changes: 12 additions & 12 deletions geost/models/basemodels.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from .model_utils import sample_along_line, sample_with_coords


class AbstractSpatial(ABC):
class AbstractSpatial(ABC): # pragma: no cover
@property
@abstractmethod
def xmin(self):
Expand Down Expand Up @@ -71,7 +71,7 @@ def select_by_values(self):
pass


class AbstractModel3D(ABC):
class AbstractModel3D(ABC): # pragma: no cover
@property
@abstractmethod
def zmin(self):
Expand Down Expand Up @@ -275,35 +275,35 @@ def select_with_points(self, points: str | Path | gpd.GeoDataFrame) -> xr.Datase

return sample_with_coords(self.ds, coords)

def select_with_line(self):
def select_with_line(self): # pragma: no cover
raise NotImplementedError()

def select_within_polygons(self):
def select_within_polygons(self): # pragma: no cover
raise NotImplementedError()

def select_within_bbox(self):
def select_within_bbox(self): # pragma: no cover
raise NotImplementedError()

def select_by_values(self):
def select_by_values(self): # pragma: no cover
raise NotImplementedError()

def select_top(self):
def select_top(self): # pragma: no cover
raise NotImplementedError()

def select_bottom(self):
def select_bottom(self): # pragma: no cover
raise NotImplementedError()

def slice_depth_interval(self):
def slice_depth_interval(self): # pragma: no cover
raise NotImplementedError()

def select_surface_level(self):
def select_surface_level(self): # pragma: no cover
raise NotImplementedError()

def zslice_to_tiff(self):
def zslice_to_tiff(self): # pragma: no cover
raise NotImplementedError()


class LayerModel(AbstractSpatial, AbstractModel3D):
class LayerModel(AbstractSpatial, AbstractModel3D): # pragma: no cover
def __init__(self):
raise NotImplementedError("No support of LayerModel yet.")

Expand Down
16 changes: 11 additions & 5 deletions geost/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ def read_nlog_cores(file: str | Path) -> BoreholeCollection:

def read_xml_geotechnical_cores(
file_or_folder: str | Path,
) -> BoreholeCollection:
) -> BoreholeCollection: # pragma: no cover
"""
NOTIMPLEMENTED
Read xml files of BRO geotechnical boreholes (IMBRO or IMBRO/A quality).
Expand All @@ -394,7 +394,9 @@ def read_xml_geotechnical_cores(
pass


def read_xml_soil_cores(file_or_folder: str | Path) -> BoreholeCollection:
def read_xml_soil_cores(
file_or_folder: str | Path,
) -> BoreholeCollection: # pragma: no cover
"""
NOTIMPLEMENTED
Read xml files of BRO soil boreholes (IMBRO or IMBRO/A quality).
Expand All @@ -403,7 +405,9 @@ def read_xml_soil_cores(file_or_folder: str | Path) -> BoreholeCollection:
pass


def read_xml_geological_cores(file_or_folder: str | Path) -> BoreholeCollection:
def read_xml_geological_cores(
file_or_folder: str | Path,
) -> BoreholeCollection: # pragma: no cover
"""
NOTIMPLEMENTED
Read xml files of DINO geological boreholes.
Expand All @@ -412,7 +416,9 @@ def read_xml_geological_cores(file_or_folder: str | Path) -> BoreholeCollection:
pass


def read_gef_cores(file_or_folder: str | Path) -> BoreholeCollection:
def read_gef_cores(
file_or_folder: str | Path,
) -> BoreholeCollection: # pragma: no cover
"""
NOTIMPLEMENTED
Read gef files of boreholes.
Expand Down Expand Up @@ -442,7 +448,7 @@ def read_gef_cpts(file_or_folder: str | Path) -> CptCollection:
return DiscreteData(df).to_collection()


def read_xml_cpts(file_or_folder: str | Path) -> CptCollection:
def read_xml_cpts(file_or_folder: str | Path) -> CptCollection: # pragma: no cover
"""
NOTIMPLEMENTED
Read xml files of cpts.
Expand Down
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ markers = [
"integrationtest: test of multiple components",
]

[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
]

[tool.black]
line-length = 88

Expand Down

0 comments on commit 5f45de8

Please sign in to comment.