-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding helper function for printing and asserting outcome of each test
- Loading branch information
1 parent
bf216ec
commit 45fca9b
Showing
5 changed files
with
70 additions
and
1 deletion.
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
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,34 @@ | ||
"""Library of classes for evaluating continuous model outputs.""" | ||
|
||
__author__ = 'Dan Vatterott' | ||
__license__ = 'MIT' | ||
|
||
|
||
def evaluate_tests(test_ouputs, assert_test=False, verbose=True): | ||
"""Check whether the data passed evaluation tests. | ||
Parameters | ||
---------- | ||
test_ouputs : list of tuples | ||
Each tuple has a string a boolean. The string describes the test. | ||
The boolean describes the outcome. True is a pass and False is a fail. | ||
This is the output of the check_data method. | ||
assert_test : bool | ||
Whether to assert the test passed. Default is False. | ||
verbose : bool | ||
Whether to print whether each test was passed or not. | ||
Returns | ||
------- | ||
None | ||
""" | ||
for test_name, test_val in test_ouputs: | ||
if test_val: | ||
if verbose: | ||
print('Passed {} test.'.format(test_name)) | ||
else: | ||
if verbose: | ||
print('Failed {} test.'.format(test_name)) | ||
if assert_test: | ||
assert test_val, 'Error. Failed {} test.' |