Skip to content

Commit

Permalink
fix default arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharyburnett committed Jul 17, 2024
1 parent 793bbdd commit 4ad6b71
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion asdf/_asdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1623,7 +1623,7 @@ def open_asdf(
ignore_unrecognized_tag=False,
_force_raw_types=False,
copy_arrays=NotSet,
memmap=True,
memmap=NotSet,
lazy_tree=NotSet,
lazy_load=True,
custom_schema=None,
Expand Down
9 changes: 5 additions & 4 deletions asdf/_tests/test_array_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -816,12 +816,13 @@ def filename_with_array(tmp_path_factory):
({"memmap": False}, False),
({"copy_arrays": True}, False),
({"copy_arrays": False}, True),
({"memmap": True, "copy_arrays": True}, True),
({"memmap": True, "copy_arrays": False}, True),
({"memmap": False, "copy_arrays": True}, False),
({"memmap": False, "copy_arrays": False}, False),
({"copy_arrays": True, "memmap": True}, True),
({"copy_arrays": False, "memmap": True}, True),
({"copy_arrays": True, "memmap": False}, False),
({"copy_arrays": False, "memmap": False}, False),
],
)
@pytest.mark.filterwarnings("ignore:copy_arrays is deprecated")
def test_open_no_memmap(filename_with_array, open_kwargs, should_memmap):
"""
Test that asdf.open does not (or does) return memmaps for arrays
Expand Down
4 changes: 2 additions & 2 deletions asdf/_tests/test_deprecated.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import asdf
import asdf.testing.helpers
from asdf.exceptions import AsdfDeprecationWarning, ValidationError
from asdf.exceptions import AsdfDeprecationWarning, AsdfWarning, ValidationError


def test_asdf_stream_deprecation():
Expand Down Expand Up @@ -155,6 +155,6 @@ def test_copy_arrays_deprecation(copy_arrays, memmap, tmp_path):
af = asdf.AsdfFile()
af["a"] = 1
af.write_to(fn)
with pytest.warns(AsdfDeprecationWarning, match="copy_arrays is deprecated; use memmap instead"):
with pytest.warns(AsdfWarning, match="copy_arrays is deprecated; use memmap instead"):
with asdf.open(fn, copy_arrays=copy_arrays, memmap=memmap) as af:
pass

0 comments on commit 4ad6b71

Please sign in to comment.