Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #59 #60

Merged
merged 2 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/scida/customs/arepo/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
pnum = int(splt[1])
offset = offsets[pnum]
length = lengths[pnum]
if hasattr(offset, "magnitude"): # hack for issue 59
offset = offset.magnitude

Check warning on line 56 in src/scida/customs/arepo/dataset.py

View check run for this annotation

Codecov / codecov/patch

src/scida/customs/arepo/dataset.py#L56

Added line #L56 was not covered by tests
if hasattr(length, "magnitude"):
length = length.magnitude

Check warning on line 58 in src/scida/customs/arepo/dataset.py

View check run for this annotation

Codecov / codecov/patch

src/scida/customs/arepo/dataset.py#L58

Added line #L58 was not covered by tests
for k, v in self.data_backup[p].items():
self.data[p][k] = v[offset : offset + length]
snap.data = self.data
Expand Down
14 changes: 14 additions & 0 deletions tests/test_issues.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# tests for gh issues. to be cleaned up and moved to the right place eventually
from scida import load
from tests.testdata_properties import require_testdata_path


@require_testdata_path("interface", only=["TNG50-4_snapshot"])
def test_issue_59(testdatapath):
# current testing of interface did not include units=True yet.
obj = load(testdatapath, units=False)
_ = obj.return_data(haloID=42)

Check warning on line 10 in tests/test_issues.py

View check run for this annotation

Codecov / codecov/patch

tests/test_issues.py#L9-L10

Added lines #L9 - L10 were not covered by tests
# for units=True, this would be a pint.Quantity, so we need to check for that
# in the Selector
obj = load(testdatapath, units=True)
_ = obj.return_data(haloID=42)

Check warning on line 14 in tests/test_issues.py

View check run for this annotation

Codecov / codecov/patch

tests/test_issues.py#L13-L14

Added lines #L13 - L14 were not covered by tests
Loading