Skip to content

Commit

Permalink
add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
BStoelzner authored and eacharles committed Nov 29, 2023
1 parent 1bb5ca4 commit 6a2952e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/qp/test_ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,13 @@ def test_mixmod_with_negative_weights(self):
with self.assertRaises(ValueError):
_ = qp.mixmod(weights=weights, means=means, stds=sigmas)

def test_mixmod_with_negative_weights(self):
"""Verify that an exception is raised when setting up a mixture model with negative weights"""
means = np.array([0.5,1.1, 2.9])
sigmas = np.array([0.15,0.13,0.14])
weights = np.array([1,0.5,-0.25])
with self.assertRaises(ValueError):
_ = qp.mixmod(gen_func=qp.stats.norm, weights=weights, data = dict(loc=means, scale=sigmas))

if __name__ == "__main__":
if __name__ == '__main__':
unittest.main()

0 comments on commit 6a2952e

Please sign in to comment.