Skip to content

Commit

Permalink
Better ordering invariance
Browse files Browse the repository at this point in the history
  • Loading branch information
Cadair committed Jan 27, 2025
1 parent 87fcae9 commit a36da67
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 1 addition & 2 deletions dkist/dataset/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,7 @@ def _load_from_directory(directory):
if len(asdfs_to_load) == 1:
return _load_from_asdf(asdfs_to_load[0])

# Ensure we load in the same order we were passed the files
return _load_from_iterable([pth for pth in asdf_files if pth in asdfs_to_load])
return _load_from_iterable(asdfs_to_load)



Expand Down
6 changes: 5 additions & 1 deletion dkist/dataset/tests/test_load_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,8 @@ def test_select_asdf(tmp_path, asdf_path, filenames, indices, mocker):
if isinstance(indices, numbers.Integral):
load_from_asdf.assert_called_once_with(asdf_file_paths[indices])
else:
load_from_iterable.assert_called_once_with([asdf_file_paths[i] for i in indices])
calls = load_from_iterable.mock_calls
# We need to assert that _load_from_iterable is called with the right
# paths but in a order-invariant way.
assert len(calls) == 1
assert set(calls[0].args[0]) == {asdf_file_paths[i] for i in indices}

0 comments on commit a36da67

Please sign in to comment.