Skip to content

Commit

Permalink
Fixing test_store_runner_to_hdf (#2198)
Browse files Browse the repository at this point in the history
* checking if the object has the attribute decode

* fixed another decode issue
  • Loading branch information
sonachitchyan authored Jan 31, 2023
1 parent 9a32544 commit eda1a46
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions tardis/io/tests/test_model_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,16 @@ def test_store_runner_to_hdf(simulation_verysimple, tmp_path):
f["runner/last_line_interaction_shell_id"],
runner_data["last_line_interaction_shell_id"],
)
assert (
f["runner/line_interaction_type"][()].decode("utf-8")
== runner_data["line_interaction_type"]
)
if hasattr(f["runner/line_interaction_type"][()], "decode"):
assert (
f["runner/line_interaction_type"][()].decode("utf-8")
== runner_data["line_interaction_type"]
)
else:
assert np.array_equal(
f["runner/line_interaction_type"][()],
runner_data["line_interaction_type"],
)
assert np.array_equal(
f["runner/nu_bar_estimator"], runner_data["nu_bar_estimator"]
)
Expand All @@ -362,10 +368,16 @@ def test_store_runner_to_hdf(simulation_verysimple, tmp_path):
f["runner/spectrum_frequency_cgs"],
runner_data["spectrum_frequency"].value,
)
assert (
f["runner/spectrum_method"][()].decode("utf-8")
== runner_data["spectrum_method"]
)
if hasattr(f["runner/spectrum_method"][()], "decode"):
assert (
f["runner/spectrum_method"][()].decode("utf-8")
== runner_data["spectrum_method"]
)
else:
assert np.array_equal(
f["runner/spectrum_method"][()],
runner_data["spectrum_method"],
)
assert np.array_equal(
f["runner/stim_recomb_cooling_estimator"],
runner_data["stim_recomb_cooling_estimator"],
Expand Down

0 comments on commit eda1a46

Please sign in to comment.