Skip to content

Commit f76b53d

Browse files
committed
update test to check reference and onthefly jsons
1 parent 13fe35b commit f76b53d

1 file changed

Lines changed: 48 additions & 10 deletions

File tree

tests/config/test_config_creator.py

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,17 +108,55 @@ def test_default_synthetic_processing_parameters(self):
108108
assert reference_file.exists()
109109
with open(reference_file, "r") as f_ref:
110110
ref_json_str = f_ref.read()
111-
p2j = json.loads(ref_json_str)
111+
p_ref = json.loads(ref_json_str)
112112
reference_processing_obj = Processing()
113-
reference_processing_obj.from_dict(p2j)
114-
# Now we want to assert that the config creators output is same as reference.
115-
# This may fail on github since the mth5_paths will be /runner/some_github_stuff whereas locally /home/kkappler
116-
# in that case, may need to create something to check only non-system specfic things , like:
117-
reference_processing_obj.id == processing_config.id
118-
# etc.
119-
# for local testing we can:
120-
assert reference_processing_obj == processing_config
121-
# TODO: mt_metadata #222 is still live and this nearly addresses it!
113+
reference_processing_obj.from_dict(p_ref)
114+
115+
# Now we want to assert that the config creator output matches the reference file.
116+
# This may fail on github since the mth5_paths will be /home/runner/some_git_path whereas locally /home/kkappler
117+
# in that case, may need to create something to check only non-system specific things , like:
118+
assert reference_processing_obj.id == processing_config.id
119+
assert (
120+
reference_processing_obj.band_specification_style
121+
== processing_config.band_specification_style
122+
)
123+
assert (
124+
reference_processing_obj.channel_nomenclature
125+
== processing_config.channel_nomenclature
126+
)
127+
assert reference_processing_obj.decimations == processing_config.decimations
128+
assert reference_processing_obj.decimations == processing_config.decimations
129+
assert (
130+
reference_processing_obj.stations.local.id
131+
== processing_config.stations.local.id
132+
)
133+
assert (
134+
reference_processing_obj.stations.local.remote
135+
== processing_config.stations.local.remote
136+
)
137+
assert (
138+
reference_processing_obj.stations.local.runs
139+
== processing_config.stations.local.runs
140+
)
141+
assert (
142+
reference_processing_obj.stations.remote[0].id
143+
== processing_config.stations.remote[0].id
144+
)
145+
assert (
146+
reference_processing_obj.stations.remote[0].remote
147+
== processing_config.stations.remote[0].remote
148+
)
149+
assert (
150+
reference_processing_obj.stations.remote[0].runs
151+
== processing_config.stations.remote[0].runs
152+
)
153+
154+
# keys to ignore, because they have paths from local machine:..
155+
# 'band_setup_file',
156+
# 'stations.local.mth5_path',
157+
# 'stations.remote[0].mth5_path (if it exists)
158+
# TODO: consider simply updating these paths during the test and simply:
159+
# assert reference_processing_obj == processing_config
122160

123161

124162
def main():

0 commit comments

Comments
 (0)