1
0
python-astropy/astropy-pr10433-wcslib73-tests.patch

124 lines
4.4 KiB
Diff
Raw Normal View History

From 89b9db3e1336fafcbd3a6ab851b7278e24c5d77d Mon Sep 17 00:00:00 2001
From: Mihai Cara <mihail.cara@gmail.com>
Date: Wed, 3 Jun 2020 01:39:28 -0400
Subject: [PATCH] deal with updated WCSLIB to v7.3 (partial pr#10433)
---
CHANGES.rst | 5 ++++-
astropy/wcs/setup_package.py | 2 +-
astropy/wcs/tests/test_wcs.py | 18 ++++++++++++++++--
astropy/wcs/tests/test_wcsprm.py | 17 +++++++++++++----
4 files changed, 34 insertions(+), 8 deletions(-)
diff --git a/astropy/wcs/setup_package.py b/astropy/wcs/setup_package.py
index c0fc32376..c7f0b09ab 100644
--- a/astropy/wcs/setup_package.py
+++ b/astropy/wcs/setup_package.py
@@ -15,7 +15,7 @@ import numpy
from astropy_helpers.distutils_helpers import get_distutils_build_option
WCSROOT = os.path.relpath(os.path.dirname(__file__))
-WCSVERSION = "7.2.0"
+WCSVERSION = "7.3.0"
def b(s):
diff --git a/astropy/wcs/tests/test_wcs.py b/astropy/wcs/tests/test_wcs.py
index 12ccc3e10..2738bc758 100644
--- a/astropy/wcs/tests/test_wcs.py
+++ b/astropy/wcs/tests/test_wcs.py
@@ -31,7 +31,7 @@ _WCSLIB_VER = LooseVersion(_wcs.__version__)
def _check_v71_dateref_warnings(w, nmax=None):
- if _WCSLIB_VER >= '7.1' and w:
+ if _WCSLIB_VER >= '7.1' and _WCSLIB_VER < '7.3' and w:
if nmax is None:
assert w
else:
@@ -375,12 +375,19 @@ def test_to_header_string():
"CRVAL2 = 0.0 / Coordinate value at reference point ",
"LATPOLE = 90.0 / [deg] Native latitude of celestial pole ",
)
- if _WCSLIB_VER >= '7.1':
+
+ if _WCSLIB_VER >= '7.3':
+ hdrstr += (
+ "MJDREF = 0.0 / [d] MJD of fiducial time ",
+ )
+
+ elif _WCSLIB_VER >= '7.1':
hdrstr += (
"DATEREF = '1858-11-17' / ISO-8601 fiducial time ",
"MJDREFI = 0.0 / [d] MJD of fiducial time, integer part ",
"MJDREFF = 0.0 / [d] MJD of fiducial time, fractional part "
)
+
hdrstr += ("END", )
header_string = ''.join(hdrstr)
@@ -397,6 +404,13 @@ def test_to_header_string():
def test_to_fits():
nrec = 11 if _WCSLIB_VER >= '7.1' else 8
+ if _WCSLIB_VER < '7.1':
+ nrec = 8
+ elif _WCSLIB_VER < '7.3':
+ nrec = 11
+ else:
+ nrec = 9
+
w = wcs.WCS()
header_string = w.to_header()
wfits = w.to_fits()
diff --git a/astropy/wcs/tests/test_wcsprm.py b/astropy/wcs/tests/test_wcsprm.py
index c25ba7961..8d8a123a7 100644
--- a/astropy/wcs/tests/test_wcsprm.py
+++ b/astropy/wcs/tests/test_wcsprm.py
@@ -435,7 +435,10 @@ def test_fix2():
del fix_ref['obsfix']
fix_ref['datfix'] = "Changed '31/12/99' to '1999-12-31'"
- if LooseVersion(version) >= '7.1':
+ if LooseVersion(version) >= '7.3':
+ fix_ref['datfix'] = "Set DATEREF to '1858-11-17' from MJDREF.\n" + fix_ref['datfix']
+
+ elif LooseVersion(version) >= '7.1':
fix_ref['datfix'] = "Set DATE-REF to '1858-11-17' from MJD-REF.\n" + fix_ref['datfix']
assert w.fix() == fix_ref
@@ -453,13 +456,17 @@ def test_fix3():
'datfix': "Invalid DATE-OBS format '31/12/F9'",
'spcfix': 'No change',
'unitfix': 'No change',
- 'celfix': 'No change'}
+ 'celfix': 'No change'
+ }
+
version = wcs._wcs.__version__
if LooseVersion(version) <= "5":
del fix_ref['obsfix']
fix_ref['datfix'] = "Invalid parameter value: invalid date '31/12/F9'"
- if LooseVersion(version) >= '7.1':
+ if LooseVersion(version) >= '7.3':
+ fix_ref['datfix'] = "Set DATEREF to '1858-11-17' from MJDREF.\n" + fix_ref['datfix']
+ elif LooseVersion(version) >= '7.1':
fix_ref['datfix'] = "Set DATE-REF to '1858-11-17' from MJD-REF.\n" + fix_ref['datfix']
assert w.fix() == fix_ref
@@ -1116,7 +1123,9 @@ def test_datebeg():
'unitfix': 'No change',
'celfix': 'No change'}
- if LooseVersion(wcs._wcs.__version__) >= '7.1':
+ if LooseVersion(wcs._wcs.__version__) >= '7.3':
+ fix_ref['datfix'] = "Set DATEREF to '1858-11-17' from MJDREF.\n" + fix_ref['datfix']
+ elif LooseVersion(wcs._wcs.__version__) >= '7.1':
fix_ref['datfix'] = "Set DATE-REF to '1858-11-17' from MJD-REF.\n" + fix_ref['datfix']
assert w.fix() == fix_ref
--
2.27.0