def test_inputs_are_allowlisted(): allowlist = config.read_allowlist() for source_file_name in os.listdir(path_utils.path_to('downloaded_dir')): source_key = os.path.splitext(source_file_name)[0] assert source_key in allowlist for source_file_name in os.listdir(path_utils.path_to('scraped_dir')): if source_file_name == 'spreadsheets': continue source_key = os.path.splitext(source_file_name)[0] assert source_key in allowlist
def test_inputs_are_allowed(): allowlist = config.read_allowlist() for source_file_name in os.listdir(DOWNLOADED_DIR): source_key = os.path.splitext(source_file_name)[0] assert source_key in allowlist for source_file_name in os.listdir(SCRAPED_DIR): if source_file_name == 'spreadsheets': continue source_key = os.path.splitext(source_file_name)[0] assert source_key in allowlist
def test_spreadsheet_tabs_against_allowlist(): allowlist = config.read_allowlist() dirpath, subdirs, filenames = next(os.walk(SPREADSHEET_DIR)) for subdir in subdirs: subdir_path = os.path.join(dirpath, subdir) hosp_file = os.path.join(subdir_path, 'hospitalizations.xlsx') xl = pd.ExcelFile(hosp_file) sheet_names = xl.sheet_names print('File: ', hosp_file) print('Sheet names in spreadsheet: ', sheet_names) print('Sheet names allowed in allowlist: ', allowlist) for sheet in sheet_names: assert sheet in allowlist, \ "Spreadsheet {} contains a sheet name {} that is not on the allowlist.".format(hosp_file, sheet)
def test_source_files_are_allowlisted(): allowlist = config.read_allowlist() for source_file_name in os.listdir(path_utils.path_to('sources_dir')): source_key = os.path.splitext(source_file_name)[0] assert source_key in allowlist
def test_data_is_allowed(): sources_with_data = config.get_sources_with_data() allowlist = config.read_allowlist() for source in sources_with_data: assert source in allowlist
def test_source_files_are_allowed(): allowlist = config.read_allowlist() for source_file_name in os.listdir(SOURCES_DIR): source_key = os.path.splitext(source_file_name)[0] assert source_key in allowlist