Skip to content

Commit

Permalink
#262 increase coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
DavAug committed Sep 21, 2022
1 parent 01a5cf5 commit 3c9f004
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions chi/tests/test_predictive_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1700,6 +1700,23 @@ def test_sample_bad_input(self):
with self.assertRaisesRegex(ValueError, 'The length of parameters'):
self.model.sample(parameters, times)

# Raises error when number of covariates and does not match model
seed = 100
times = [1, 2, 3, 4, 5]
parameters = [1, 1, 1, 1, 1, 1, 1, 0.1, 0.1, 2, 3]
covariates = [1.3, 2.4, 1]
with self.assertRaisesRegex(ValueError, 'Provided covariates do not'):
self.model2.sample(
parameters, times, seed=seed, covariates=covariates)

# Raises error when the covariates per sample do not match n_samples
n_samples = 3
covariates = np.ones(shape=(5, 2))
with self.assertRaisesRegex(ValueError, 'Provided covariates cannot'):
self.model2.sample(
parameters, times, seed=seed, covariates=covariates,
n_samples=n_samples)


class TestPriorPredictiveModel(unittest.TestCase):
"""
Expand Down

0 comments on commit 3c9f004

Please sign in to comment.