Skip to content

Commit 787a10e

Browse files
committed
Add pragma no cover to exception branches
Added '# pragma: no cover' to NotImplementedError and ValueError branches in PyMCModel to exclude them from test coverage reporting.
1 parent 1a0b078 commit 787a10e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

causalpy/pymc_models.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@ def __init__(
115115

116116
def build_model(self, X, y, coords) -> None:
117117
"""Build the model, must be implemented by subclass."""
118-
raise NotImplementedError("This method must be implemented by a subclass")
118+
raise NotImplementedError(
119+
"This method must be implemented by a subclass"
120+
) # pragma: no cover
119121

120122
def _data_setter(self, X: xr.DataArray) -> None:
121123
"""
@@ -274,7 +276,9 @@ def print_coefficients_for_unit(
274276
elif "y_hat_sigma" in self.idata.posterior:
275277
sigma_var_name = "y_hat_sigma"
276278
else:
277-
raise ValueError("Neither 'sigma' nor 'y_hat_sigma' found in posterior")
279+
raise ValueError(
280+
"Neither 'sigma' nor 'y_hat_sigma' found in posterior"
281+
) # pragma: no cover
278282

279283
treated_units = coeffs.coords["treated_units"].values
280284
for unit in treated_units:

0 commit comments

Comments
 (0)