Skip to content

Commit

Permalink
Fix for windows (pathlib internally uses "/" for paths, so string com…
Browse files Browse the repository at this point in the history
…parison is fraught).
  • Loading branch information
delucchi-cmu committed Jan 8, 2025
1 parent 11c14ca commit 0439016
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions tests/hats_import/verification/test_run_verification.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ def test_test_file_sets(small_sky_object_catalog, wrong_files_and_rows_dir, tmp_
verifier = runner.Verifier.from_args(args)
passed = verifier.test_file_sets()
assert not passed, "bad catalog passed"
bad_files = {
str(COMMON_DIR / "Npix=11.extra_file.parquet"),
str(COMMON_DIR / "Npix=11.missing_file.parquet"),
expected_bad_file_names = {"Npix=11.extra_file.parquet", "Npix=11.missing_file.parquet"}
actual_bad_file_names = {
file_name.replace("\\", "/").split("/")[-1] for file_name in verifier.results_df.bad_files.squeeze()
}
assert bad_files == set(verifier.results_df.bad_files.squeeze()), "bad_files failed"
assert expected_bad_file_names == actual_bad_file_names, "bad_files failed"


def test_test_is_valid_catalog(small_sky_object_catalog, wrong_files_and_rows_dir, tmp_path):
Expand Down Expand Up @@ -92,13 +92,14 @@ def test_test_num_rows(small_sky_object_catalog, wrong_files_and_rows_dir, tmp_p
targets = {"file footers vs _metadata", "file footers vs truth"}
assert targets == set(results.target), "wrong targets"

bad_files = {
str(COMMON_DIR / "Npix=11.extra_file.parquet"),
str(COMMON_DIR / "Npix=11.extra_rows.parquet"),
str(COMMON_DIR / "Npix=11.missing_file.parquet"),
expected_bad_file_names = {
"Npix=11.extra_file.parquet",
"Npix=11.extra_rows.parquet",
"Npix=11.missing_file.parquet",
}
_result = results.loc[results.target == "file footers vs _metadata"].squeeze()
assert bad_files == set(_result.bad_files), "wrong bad_files"
actual_bad_file_names = {file_name.replace("\\", "/").split("/")[-1] for file_name in _result.bad_files}
assert expected_bad_file_names == actual_bad_file_names, "wrong bad_files"


@pytest.mark.parametrize("check_metadata", [(False,), (True,)])
Expand Down

0 comments on commit 0439016

Please sign in to comment.