-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from BritishGeologicalSurvey/fix-open-issue
Fix open issue regarding warnings for criteria without data (Issue #4)
- Loading branch information
Showing
4 changed files
with
84 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import pytest | ||
|
||
from pyvolcans import pyvolcans_func | ||
|
||
|
||
@pytest.mark.parametrize('volcano, weights, expected', [ | ||
('Korath Range', | ||
{'tectonic_setting': 0.2, | ||
'geochemistry': 0.2, | ||
'morphology': 0.2, | ||
'eruption_size': 0.2, | ||
'eruption_style': 0.2}, | ||
r'.* morphology .* eruption_size .* eruption_style'), | ||
('Korath Range', | ||
{'tectonic_setting': 0.2, | ||
'geochemistry': 0.4, | ||
'morphology': 0, | ||
'eruption_size': 0.2, | ||
'eruption_style': 0.2}, | ||
r'.* eruption_size .* eruption_style'), | ||
('Korath Range', | ||
{'tectonic_setting': 0.2, | ||
'geochemistry': 0.2, | ||
'morphology': 0, | ||
'eruption_size': 0, | ||
'eruption_style': 0.6}, | ||
r'.* eruption_style'), | ||
]) | ||
def test_calculate_weighted_analogy_matrix_warnings(volcano, weights, expected): | ||
"""Test that warnings include correct missing criteria, | ||
based on regular expression match.""" | ||
with pytest.warns(UserWarning, match=expected): | ||
pyvolcans_func.calculate_weighted_analogy_matrix(volcano, weights) |