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

Removed support for version = '1.0' on VOTable #15490

Merged
merged 4 commits into from Oct 17, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 4 additions & 8 deletions astropy/io/votable/tests/test_tree.py
Expand Up @@ -11,7 +11,6 @@
from astropy.io.votable.tree import MivotBlock, Resource, VOTableFile
from astropy.tests.helper import PYTEST_LT_8_0
from astropy.utils.data import get_pkg_data_filename
from astropy.utils.exceptions import AstropyDeprecationWarning


def test_check_astroyear_fail():
Expand Down Expand Up @@ -93,18 +92,15 @@ def test_namespace_warning():

def test_version():
"""
VOTableFile.__init__ allows versions of '1.0', '1.1', '1.2', '1.3' and '1.4'.
The '1.0' is curious since other checks in parse() and the version setter do not allow '1.0'.
This test confirms that behavior for now. A future change may remove the '1.0'.
VOTableFile.__init__ allows versions of '1.1', '1.2', '1.3' and '1.4'.
VOTableFile.__init__ does not allow version of '1.0' anymore and now raises a ValueError as it does to other versions not supported.
"""
# Exercise the checks in __init__
with pytest.warns(AstropyDeprecationWarning):
VOTableFile(version="1.0")
for version in ("1.1", "1.2", "1.3", "1.4"):
VOTableFile(version=version)
for version in ("0.9", "2.0"):
for version in ("0.9", "1.0", "2.0"):
with pytest.raises(
ValueError, match=r"should be in \('1.0', '1.1', '1.2', '1.3', '1.4'\)."
ValueError, match=r"should be in \('1.1', '1.2', '1.3', '1.4'\)."
):
VOTableFile(version=version)

Expand Down
12 changes: 2 additions & 10 deletions astropy/io/votable/tree.py
Expand Up @@ -9,7 +9,6 @@
import os
import re
import urllib.request
import warnings

# THIRD-PARTY
import numpy as np
Expand All @@ -19,7 +18,6 @@
from astropy import __version__ as astropy_version
from astropy.io import fits
from astropy.utils.collections import HomogeneousList
from astropy.utils.exceptions import AstropyDeprecationWarning
from astropy.utils.xml import iterparser
from astropy.utils.xml.writer import XMLWriter

Expand Down Expand Up @@ -3970,15 +3968,9 @@
self._groups = HomogeneousList(Group)

version = str(version)
if version == "1.0":
warnings.warn(
"VOTable 1.0 support is deprecated in astropy 4.3 and will be "
"removed in a future release",
AstropyDeprecationWarning,
)
elif (version != "1.0") and (version not in self._version_namespace_map):
if version not in self._version_namespace_map:

Check warning on line 3971 in astropy/io/votable/tree.py

View check run for this annotation

Codecov / codecov/patch

astropy/io/votable/tree.py#L3971

Added line #L3971 was not covered by tests
allowed_from_map = "', '".join(self._version_namespace_map)
raise ValueError(f"'version' should be in ('1.0', '{allowed_from_map}').")
raise ValueError(f"'version' should be in ('{allowed_from_map}').")

Check warning on line 3973 in astropy/io/votable/tree.py

View check run for this annotation

Codecov / codecov/patch

astropy/io/votable/tree.py#L3973

Added line #L3973 was not covered by tests

self._version = version

Expand Down
2 changes: 2 additions & 0 deletions docs/changes/io.votable/15490.api.rst
@@ -0,0 +1,2 @@
Fully removed support for version = '1.0' on ``VOTableFile__init__()`` and changed its tests to check correctly.
It was raising a ``DeprecationWarning`` and now is raising a ``ValueError``.