Skip to content

Commit

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

Backport PR #14358 on branch v5.2.x (Ignore an asdf deprecation)
  • Loading branch information
pllim committed Feb 6, 2023
2 parents 0814c4a + f3844df commit 00139c8
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
Expand Up @@ -15,6 +15,9 @@
)


@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 @@ -24,6 +27,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 @@ -37,6 +43,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
Expand Up @@ -19,6 +19,9 @@
from astropy.time import Time, TimeDelta # noqa: E402


@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 @@ -33,6 +36,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 @@ -52,6 +58,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 @@ -66,6 +75,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 @@ -84,6 +96,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 @@ -132,6 +147,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 @@ -225,6 +243,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 00139c8

Please sign in to comment.