Skip to content

Commit

Permalink
Added a unit test specifically for the threshold function.
Browse files Browse the repository at this point in the history
  • Loading branch information
mattj89 committed Jul 2, 2024
1 parent 2b1fb4c commit 3ca9e6c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"python.testing.pytestArgs": [
"tests"
"tests",
"--no-cov"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
Expand Down
8 changes: 8 additions & 0 deletions tests/component/test_source_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@ def test_make_sampler(source_model):
assert isinstance(sampler_object[0], NormalNormal)


def test_coverage_function(source_model):
"""Test that the coverage function has defaulted correctly."""
random_vars = np.random.normal(0, 1, size=(10000, 1))
threshold_value = source_model.threshold_function(random_vars)
assert threshold_value.shape == (1, )
assert np.allclose(threshold_value, np.quantile(random_vars, 0.95))


def test_birth_function(source_model):
"""Test the birth_function implementation, and some aspects of the reversible jump sampler.
Expand Down

0 comments on commit 3ca9e6c

Please sign in to comment.