Skip to content

Commit

Permalink
Adapting test checks to python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
mmerce committed Jan 15, 2025
1 parent 19f2073 commit f876bd4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
3 changes: 2 additions & 1 deletion bigmler/tests/basic_tst_prediction_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,8 @@ def i_check_cross_validation(step, check_file):
check_content = json.loads(check_handler.read())
except Exception as exc:
ok_(False, msg=str(exc))
eq_(cv_content['model'], check_content['model'])
eq_(cv_content['model']['confusion_matrix'],
check_content['model']['confusion_matrix'])


def i_check_stored_source(step):
Expand Down
20 changes: 15 additions & 5 deletions bigmler/tests/evaluation_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from bigml.api import check_resource

from bigmler.tests.common_steps import shell_execute
from bigmler.tests.world import world, res_filename, ok_, eq_
from bigmler.tests.world import world, res_filename, ok_, eq_, approx_


def given_i_create_bigml_resources_using_source_to_evaluate(
Expand Down Expand Up @@ -131,10 +131,20 @@ def then_the_evaluation_file_is_like(step, check_file_json):
if 'model' in check:
for metric, value in check['model'].items():
if not isinstance(value, list) and not isinstance(value, dict):
eq_(check['model'][metric], evaluation['model'][metric],
msg=f"model {metric}")
eq_(check['mode'][metric], evaluation['mode'][metric],
msg=f"mode {metric}")
if isinstance(value,str):
eq(check['model'][metric],
evaluation['model'][metric],
msg=f"model {metric}")
eq_(check['mode'][metric],
evaluation['mode'][metric],
msg=f"mode {metric}")
else:
approx_(check['model'][metric],
evaluation['model'][metric],
msg=f"model {metric}")
approx_(check['mode'][metric],
evaluation['mode'][metric],
msg=f"mode {metric}")
else:
del check["datasets"]
del evaluation["datasets"]
Expand Down

0 comments on commit f876bd4

Please sign in to comment.