Skip to content

Commit

Permalink
resolve conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
BStoelzner authored and eacharles committed Oct 24, 2023
1 parent 0601538 commit 090c8fa
Showing 1 changed file with 0 additions and 41 deletions.
41 changes: 0 additions & 41 deletions tests/qp/test_ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,47 +213,6 @@ def test_iterator(self):
test_vals = ens_i.pdf(test_grid)
assert np.allclose(check_vals, test_vals)

def test_quant_get_default_pdf_constructor_name(self):
"""Test that the getter for pdf constructor name works"""
quantiles = np.linspace(0.001, 0.999, 16)
locations = np.linspace(0, 5, 16)
quant_dist = qp.quant(quants=quantiles, locs=locations)
self.assertEqual(quant_dist.dist.pdf_constructor_name, 'piecewise_linear')

def test_quant_get_default_pdf_constructor(self):
"""Test that the getter for pdf constructor returns an AbstractQuantilePdfConstructor"""
quantiles = np.linspace(0.001, 0.999, 16)
locations = np.linspace(0, 5, 16)
quant_dist = qp.quant(quants=quantiles, locs=locations)
assert isinstance(quant_dist.dist.pdf_constructor, AbstractQuantilePdfConstructor)

def test_quant_change_pdf_constructor(self):
"""Test that changing the pdf constructor works as expected"""
quantiles = np.linspace(0.001, 0.999, 16)
locations = np.linspace(0, 5, 16)
quant_dist = qp.quant(quants=quantiles, locs=locations)
quant_dist.dist.pdf_constructor_name = 'piecewise_constant'
self.assertEqual(quant_dist.dist.pdf_constructor_name, 'piecewise_constant')

def test_quant_change_pdf_constructor_raises(self):
"""Verify that attempting to change the pdf constructor to one that
isn't in the dictionary, will raise an error."""
quantiles = np.linspace(0.001, 0.999, 16)
locations = np.linspace(0, 5, 16)
quant_dist = qp.quant(quants=quantiles, locs=locations)
with self.assertRaises(ValueError):
quant_dist.dist.pdf_constructor_name = 'drewtonian'

def test_quant_change_pdf_constructor_warns(self):
"""Verify that attempting to change the pdf constructor to the one
currently being used will log a warning."""
quantiles = np.linspace(0.001, 0.999, 16)
locations = np.linspace(0, 5, 16)
quant_dist = qp.quant(quants=quantiles, locs=locations)
with self.assertLogs(level=logging.WARNING) as log:
quant_dist.dist.pdf_constructor_name = 'piecewise_linear'
self.assertIn('Already using', log.output[0])

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])
Expand Down

0 comments on commit 090c8fa

Please sign in to comment.