Skip to content

Commit

Permalink
skip parameter-values key in comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
ilia-nikiforov-umn committed Nov 7, 2023
1 parent dd0be9c commit 7725b64
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions test/test_scripts_and_data/compare_dbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
import numpy as np
import json


# TODO: more sophisticated checks for these keys
KEYS_TO_SKIP = ["parameter-values"]


def compare_db_to_reference(reference_json_path: str, test_db_path: str, float_fractional_tolerance: float = 0.01):
"""
Compare a montydb generated by tests in the KDP to a reference json file.
Expand Down Expand Up @@ -30,7 +35,7 @@ def compare_db_to_reference(reference_json_path: str, test_db_path: str, float_f
# VC comments may be a string with float numbers embedded, too much hassle to test
continue
if isinstance(reference_result[key],dict):
if "source-value" in reference_result[key]:
if ("source-value" in reference_result[key]) and (key not in KEYS_TO_SKIP):
# ok, this is a property key, search for this result
# generic error message
error_message_specifying_pair_and_key = "\n\nTest failed while comparing to key '%s' in instance-id %d in reference runner-subject pair %s:\n" \
Expand All @@ -39,8 +44,6 @@ def compare_db_to_reference(reference_json_path: str, test_db_path: str, float_f
# get numpy array of the source-value from the reference db
reference_source_value_array = np.asarray(reference_result[key]["source-value"])



"""
MONTYDB VERSION NOTE:
In 2.1.1, the version in the KDP, querying the /pipeline/db like this gives and requires dicts
Expand All @@ -54,8 +57,7 @@ def compare_db_to_reference(reference_json_path: str, test_db_path: str, float_f
"meta.uuid":{"$regex":reference_runner_and_subject},
"instance-id.$numberInt":str(reference_instance_id)
}
project={key:1,"_id":False}
cursor=db.data.find(query,projection=project)
cursor=db.data.find(query)

# get numpy array of the source-value from the DB we are testing
try:
Expand Down

0 comments on commit 7725b64

Please sign in to comment.