Skip to content

Commit

Permalink
Merge pull request #14366 from meeseeksmachine/auto-backport-of-pr-14…
Browse files Browse the repository at this point in the history
…358-on-v5.0.x

Backport PR #14358 on branch v5.0.x (Ignore an asdf deprecation)
  • Loading branch information
pllim committed Feb 6, 2023
2 parents 57a9c5d + 3be9c3f commit 7da3cfd
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
9 changes: 9 additions & 0 deletions astropy/io/misc/asdf/tags/fits/tests/test_fits.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
from astropy.io.misc.asdf.tags.tests.helpers import run_schema_example_test


@pytest.mark.filterwarnings(
"ignore:The property AsdfFile.blocks has been deprecated:asdf.exceptions.AsdfDeprecationWarning"
)
def test_complex_structure(tmpdir):
with fits.open(
os.path.join(os.path.dirname(__file__), "data", "complex.fits"), memmap=False
Expand All @@ -25,6 +28,9 @@ def test_complex_structure(tmpdir):
helpers.assert_roundtrip_tree(tree, tmpdir)


@pytest.mark.filterwarnings(
"ignore:The property AsdfFile.blocks has been deprecated:asdf.exceptions.AsdfDeprecationWarning"
)
def test_fits_table(tmpdir):
a = np.array([(0, 1), (2, 3)], dtype=[("A", int), ("B", int)])

Expand All @@ -38,6 +44,9 @@ def check_yaml(content):
helpers.assert_roundtrip_tree(tree, tmpdir, raw_yaml_check_func=check_yaml)


@pytest.mark.filterwarnings(
"ignore:The property AsdfFile.blocks has been deprecated:asdf.exceptions.AsdfDeprecationWarning"
)
def test_backwards_compat():
"""
Make sure that we can continue to read FITS HDUs that use the schema from
Expand Down
21 changes: 21 additions & 0 deletions astropy/io/misc/asdf/tags/table/tests/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
from astropy.io.misc.asdf.tags.tests.helpers import run_schema_example_test


@pytest.mark.filterwarnings(
"ignore:The property AsdfFile.blocks has been deprecated:asdf.exceptions.AsdfDeprecationWarning"
)
def test_table(tmpdir):
data_rows = [(1, 2.0, "x"), (4, 5.0, "y"), (5, 8.2, "z")]
t = table.Table(rows=data_rows, names=("a", "b", "c"), dtype=("i4", "f8", "S1"))
Expand All @@ -34,6 +37,9 @@ def check(ff):
helpers.assert_roundtrip_tree({"table": t}, tmpdir, asdf_check_func=check)


@pytest.mark.filterwarnings(
"ignore:The property AsdfFile.blocks has been deprecated:asdf.exceptions.AsdfDeprecationWarning"
)
def test_array_columns(tmpdir):
a = np.array(
[
Expand All @@ -53,6 +59,9 @@ def check(ff):
helpers.assert_roundtrip_tree({"table": t}, tmpdir, asdf_check_func=check)


@pytest.mark.filterwarnings(
"ignore:The property AsdfFile.blocks has been deprecated:asdf.exceptions.AsdfDeprecationWarning"
)
def test_structured_array_columns(tmpdir):
a = np.array(
[((1, "a"), 2.0, "x"), ((4, "b"), 5.0, "y"), ((5, "c"), 8.2, "z")],
Expand All @@ -67,6 +76,9 @@ def check(ff):
helpers.assert_roundtrip_tree({"table": t}, tmpdir, asdf_check_func=check)


@pytest.mark.filterwarnings(
"ignore:The property AsdfFile.blocks has been deprecated:asdf.exceptions.AsdfDeprecationWarning"
)
def test_table_row_order(tmpdir):
a = np.array(
[(1, 2.0, "x"), (4, 5.0, "y"), (5, 8.2, "z")],
Expand All @@ -85,6 +97,9 @@ def check(ff):
helpers.assert_roundtrip_tree({"table": t}, tmpdir, asdf_check_func=check)


@pytest.mark.filterwarnings(
"ignore:The property AsdfFile.blocks has been deprecated:asdf.exceptions.AsdfDeprecationWarning"
)
def test_table_inline(tmpdir):
data_rows = [(1, 2.0, "x"), (4, 5.0, "y"), (5, 8.2, "z")]
t = table.Table(rows=data_rows, names=("a", "b", "c"), dtype=("i4", "f8", "S1"))
Expand Down Expand Up @@ -133,6 +148,9 @@ def test_mismatched_columns():
assert "Inconsistent data column lengths" in str(err.value)


@pytest.mark.filterwarnings(
"ignore:The property AsdfFile.blocks has been deprecated:asdf.exceptions.AsdfDeprecationWarning"
)
def test_masked_table(tmpdir):
data_rows = [(1, 2.0, "x"), (4, 5.0, "y"), (5, 8.2, "z")]
t = table.Table(
Expand Down Expand Up @@ -226,6 +244,9 @@ def test_ndarray_mixin(tmpdir):
helpers.assert_roundtrip_tree({"table": t}, tmpdir)


@pytest.mark.filterwarnings(
"ignore:The property AsdfFile.blocks has been deprecated:asdf.exceptions.AsdfDeprecationWarning"
)
def test_backwards_compat():
"""
Make sure that we can continue to read tables that use the schema from
Expand Down

0 comments on commit 7da3cfd

Please sign in to comment.