Skip to content

Commit

Permalink
Towards finishing support for mth5 file_version 0.2.0
Browse files Browse the repository at this point in the history
- Changed call to read_back_data to pass survey kwarg
- tested build and readback of CAS04 with mth5 file_version="0.2.0"
- added some extra lines to synthetic test to make codecov happier
- added test for general_helper_functions
- moved some tests into tests/time_series/

[Issue(s): #200]
  • Loading branch information
kkappler committed Jul 30, 2022
1 parent 142eceb commit 423a09e
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 7 deletions.
15 changes: 9 additions & 6 deletions tests/cas04/01_make_cas04_mth5.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,17 +141,20 @@ def test_make_mth5(mth5_version="0.1.0"):
Where the built mth5 lives
"""
mth5_path = make_all_stations(mth5_version=mth5_version)

read_back_data(mth5_path, "CAS04", "a")
read_back_data(mth5_path, "CAS04", "b")
read_back_data(mth5_path, "CAS04", "c")
read_back_data(mth5_path, "CAS04", "d")
if mth5_version == "0.1.0":
survey = None
else:
survey = "CONUS South"
read_back_data(mth5_path, "CAS04", "a", survey=survey)
read_back_data(mth5_path, "CAS04", "b", survey=survey)
read_back_data(mth5_path, "CAS04", "c", survey=survey)
read_back_data(mth5_path, "CAS04", "d", survey=survey)

return mth5_path


def main():
mth5_path = test_make_mth5(mth5_version="0.1.0") # passes
# mth5_path = test_make_mth5(mth5_version="0.1.0") # passes
mth5_path = test_make_mth5(mth5_version="0.2.0") # passes 29 Jul 2022
return mth5_path

Expand Down
5 changes: 4 additions & 1 deletion tests/synthetic/test_synthetic_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,12 @@ def process_synthetic_1(
mth5_path,
]
)
# next two lines purely for codecov
run_summary.print_mini_summary
run_summary_clone = run_summary.clone()
# run_summary.drop_runs_shorter_than(100000)
tfk_dataset = KernelDataset()
tfk_dataset.from_run_summary(run_summary, "test1")
tfk_dataset.from_run_summary(run_summary_clone, "test1")

# Test that channel_scale_factors column is optional
if test_scale_factor:
Expand Down
27 changes: 27 additions & 0 deletions tests/test_general_helper_functions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import pathlib

from aurora.general_helper_functions import count_lines
from aurora.general_helper_functions import TEST_PATH


def test_count_lines():
tmp_file = TEST_PATH.joinpath("tmp.txt")
n_lines_in = 42
lines = n_lines_in * ["test\n"]
f = open(tmp_file, "w")
f.writelines(lines)
f.close()
n_lines_out = count_lines(tmp_file)
assert n_lines_out == n_lines_in
tmp_file.unlink()
return


def test():
""" """
test_count_lines()
print("finito")


if __name__ == "__main__":
test()
File renamed without changes.
File renamed without changes.

0 comments on commit 423a09e

Please sign in to comment.