Skip to content

Commit

Permalink
#293 make sure we cover null logging
Browse files Browse the repository at this point in the history
  • Loading branch information
martinjrobins committed Aug 19, 2020
1 parent 7bbf89c commit 298fd5d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pints/tests/test_mcmc_nuts.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,17 @@ def test_method(self):
# This method needs sensitivities
self.assertTrue(mcmc.needs_sensitivities())

# Perform short run
# Perform short run, test logging while we are at it
logger = pints.Logger()
logger.set_stream(None)
mcmc._log_init(logger)
chain = []
for i in range(2 * mcmc.number_adaption_steps()):
x = mcmc.ask()
fx, gr = log_pdf.evaluateS1(x)
sample = mcmc.tell((fx, gr))
mcmc._log_write(logger)

if sample is not None:
chain.append(sample)
if np.all(sample == x):
Expand Down

0 comments on commit 298fd5d

Please sign in to comment.