Skip to content

Commit

Permalink
Made samples 100% coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
williamjameshandley committed Aug 19, 2020
1 parent 52aaae3 commit a299ba2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tests/test_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ def test_gui():
plotter = NestedSamples(root='./tests/example_data/pc').gui()

# Type buttons
plotter.type.buttons.set_active(0)
assert(plotter.type() == 'live')
plotter.type.buttons.set_active(1)
assert(plotter.type() == 'posterior')
plotter.type.buttons.set_active(0)
assert(plotter.type() == 'live')

# Parameter choice buttons
plotter.param_choice.buttons.set_active(1)
Expand All @@ -25,11 +25,17 @@ def test_gui():
plotter.evolution.slider.set_val(100)
assert(plotter.evolution() == 100)
plotter.type.buttons.set_active(1)

plotter.temperature.slider.set_val(0)
assert(plotter.temperature() == 1)

plotter.temperature.slider.set_val(1)
assert(plotter.temperature() == 10)
plotter.temperature.slider.set_val(2)
assert(plotter.temperature() == 100)
plotter.type.buttons.set_active(0)

# Reload button
plotter.reload.button.observers[0](None)

# Reset button
plotter.reset.button.observers[0](None)
7 changes: 7 additions & 0 deletions tests/test_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,13 @@ def test_plot_2d_types():
fig, axes = ns.plot_2d(params, types={'lower': 'kde', 'diagonal': 'kde',
'upper': 'scatter'})
assert((~axes.isnull()).sum().sum() == 12)

with pytest.raises(NotImplementedError):
fig, axes = ns.plot_2d(params, types={'lower': 'not a plot type'})

with pytest.raises(NotImplementedError):
fig, axes = ns.plot_2d(params, types={'diagonal': 'not a plot type'})

plt.close("all")


Expand Down

0 comments on commit a299ba2

Please sign in to comment.