Module redvox.tests.local_tests
tests that cannot be sent to git, but must pass are here
Expand source code
"""
tests that cannot be sent to git, but must pass are here
"""
import timeit
from redvox.common.data_window import DataWindow, DataWindowConfig
def synthetic_test():
path = "/Users/tyler/IdeaProjects/projects-2022/projects_2022/tyler/synthetic_api_m/api1000"
cfg = DataWindowConfig(path, structured_layout=False)
print("test using synthetics")
dy_me = DataWindow("empty_test", config=cfg)
assert dy_me.first_station() is not None
def empty_test():
my_dir = "not_exist"
cfg = DataWindowConfig(my_dir, structured_layout=False)
print("test using empty directory")
dy_me = DataWindow("empty_test", config=cfg)
assert dy_me.first_station() is None
def save_fail_test():
my_dir = "not_exist"
cfg = DataWindowConfig(my_dir, structured_layout=False)
print("test using empty directory")
dy_me = DataWindow("empty_test", config=cfg)
dy_me.save()
assert dy_me._errors.get_num_errors() == 1
def big_data_test():
big_data_dir = "/Users/tyler/Documents/big_data_file_read"
cfg = DataWindowConfig(big_data_dir, structured_layout=True)
print("test using lots of data")
strt = timeit.default_timer()
dy_me = DataWindow("big_test", config=cfg, debug=True)
end = timeit.default_timer()
print("elapsed data window time: ", end - strt)
assert dy_me.first_station() is not None
def gaps_test():
big_data_dir = "/Users/tyler/Documents/skyfall2full"
cfg = DataWindowConfig(big_data_dir, structured_layout=True)
print("test using skyfall with gaps")
strt = timeit.default_timer()
dy_me = DataWindow("skyfall_test", config=cfg, debug=True)
end = timeit.default_timer()
print("elapsed data window time: ", end - strt)
assert dy_me.first_station() is not None
if __name__ == "__main__":
save_fail_test()
print("**********************")
synthetic_test()
print("**********************")
empty_test()
print("**********************")
big_data_test()
print("**********************")
gaps_test()
Functions
def big_data_test()
-
Expand source code
def big_data_test(): big_data_dir = "/Users/tyler/Documents/big_data_file_read" cfg = DataWindowConfig(big_data_dir, structured_layout=True) print("test using lots of data") strt = timeit.default_timer() dy_me = DataWindow("big_test", config=cfg, debug=True) end = timeit.default_timer() print("elapsed data window time: ", end - strt) assert dy_me.first_station() is not None
def empty_test()
-
Expand source code
def empty_test(): my_dir = "not_exist" cfg = DataWindowConfig(my_dir, structured_layout=False) print("test using empty directory") dy_me = DataWindow("empty_test", config=cfg) assert dy_me.first_station() is None
def gaps_test()
-
Expand source code
def gaps_test(): big_data_dir = "/Users/tyler/Documents/skyfall2full" cfg = DataWindowConfig(big_data_dir, structured_layout=True) print("test using skyfall with gaps") strt = timeit.default_timer() dy_me = DataWindow("skyfall_test", config=cfg, debug=True) end = timeit.default_timer() print("elapsed data window time: ", end - strt) assert dy_me.first_station() is not None
def save_fail_test()
-
Expand source code
def save_fail_test(): my_dir = "not_exist" cfg = DataWindowConfig(my_dir, structured_layout=False) print("test using empty directory") dy_me = DataWindow("empty_test", config=cfg) dy_me.save() assert dy_me._errors.get_num_errors() == 1
def synthetic_test()
-
Expand source code
def synthetic_test(): path = "/Users/tyler/IdeaProjects/projects-2022/projects_2022/tyler/synthetic_api_m/api1000" cfg = DataWindowConfig(path, structured_layout=False) print("test using synthetics") dy_me = DataWindow("empty_test", config=cfg) assert dy_me.first_station() is not None