Skip to content
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
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
------------------

- drop support for numpy 1.25. [#285]
- require asdf 3.3 and drop support for astropy 5.2 [#297]

0.8.0 (2025-06-11)
------------------
Expand Down
15 changes: 4 additions & 11 deletions asdf_astropy/converters/unit/tests/test_quantity.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,11 @@
from asdf.testing import helpers
from astropy import units
from astropy.units import Quantity
from astropy.utils.introspection import minversion
from numpy.testing import assert_array_equal

from asdf_astropy.tests.versions import ASTROPY_GE_7_1


def asdf_open_memory_mapping_kwarg(memmap: bool) -> dict:
if minversion("asdf", "3.1.0"):
return {"memmap": memmap}
return {"copy_arrays": not memmap}


def create_quantities():
return [
# Scalar:
Expand Down Expand Up @@ -104,7 +97,7 @@ def test_memmap(tmp_path):
af.write_to(file_path)

# Update a value in the ASDF file
with asdf.open(file_path, mode="rw", **asdf_open_memory_mapping_kwarg(memmap=True)) as af:
with asdf.open(file_path, mode="rw", memmap=True) as af:
assert (af.tree["quantity"] == quantity).all()
assert af.tree["quantity"][-1, -1] != new_value

Expand All @@ -114,7 +107,7 @@ def test_memmap(tmp_path):
assert (af.tree["quantity"] != quantity).any()
assert (af.tree["quantity"] == new_quantity).all()

with asdf.open(file_path, mode="rw", **asdf_open_memory_mapping_kwarg(memmap=True)) as af:
with asdf.open(file_path, mode="rw", memmap=True) as af:
assert af.tree["quantity"][-1, -1] == new_value
assert (af.tree["quantity"] != quantity).any()
assert (af.tree["quantity"] == new_quantity).all()
Expand All @@ -137,7 +130,7 @@ def test_no_memmap(tmp_path):
af.write_to(file_path)

# Update a value in the ASDF file
with asdf.open(file_path, mode="rw", **asdf_open_memory_mapping_kwarg(memmap=False)) as af:
with asdf.open(file_path, mode="rw", memmap=False) as af:
assert (af.tree["quantity"] == quantity).all()
assert af.tree["quantity"][-1, -1] != new_value

Expand All @@ -147,7 +140,7 @@ def test_no_memmap(tmp_path):
assert (af.tree["quantity"] != quantity).any()
assert (af.tree["quantity"] == new_quantity).all()

with asdf.open(file_path, mode="rw", **asdf_open_memory_mapping_kwarg(memmap=False)) as af:
with asdf.open(file_path, mode="rw", memmap=False) as af:
assert af.tree["quantity"][-1, -1] != new_value
assert (af.tree["quantity"] != new_quantity).any()
assert (af.tree["quantity"] == quantity).all()
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ dynamic = [
'version',
]
dependencies = [
"asdf>=2.15.0",
"asdf>=3.3.0",
"asdf-coordinates-schemas>=0.4",
"asdf-transform-schemas>=0.6",
"asdf-standard>=1.1.0",
"astropy>=5.2.0",
"astropy>=5.3.0",
"numpy>=1.26",
"packaging>=19",
]
Expand Down
Loading