From 7f3dc495a7d9a8bd10a031333b6814c831431558 Mon Sep 17 00:00:00 2001 From: Jeremy Kubica <104161096+jeremykubica@users.noreply.github.com> Date: Tue, 17 Dec 2024 15:24:59 -0500 Subject: [PATCH] Fix the mock fits errors --- tests/test_results.py | 1 - tests/utils/mock_fits.py | 8 ++++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/test_results.py b/tests/test_results.py index 21a5babfd..30ba6d44d 100644 --- a/tests/test_results.py +++ b/tests/test_results.py @@ -278,7 +278,6 @@ def test_is_empty_value(self): self.assertFalse(np.any(nums_is_empty)) pairs_is_empty = table.is_empty_value("pairs") - print(pairs_is_empty) self.assertTrue(np.array_equal(pairs_is_empty, expected)) def test_filter_by_index(self): diff --git a/tests/utils/mock_fits.py b/tests/utils/mock_fits.py index 305ee517f..501640d07 100644 --- a/tests/utils/mock_fits.py +++ b/tests/utils/mock_fits.py @@ -161,6 +161,14 @@ def get_fits(self, fits_idx, spoof_data=False): warnings.filterwarnings("ignore", category=AstropyUserWarning) for hdr_idx, HDUClass in enumerate(self.hdu_types): hdr = HDUClass() + + # Remove the cards that know we will reinsert them below and + # require a specific order. We rely on the file order. + for key in ["GCOUNT", "NAXIS", "NAXIS1", "NAXIS2", "PCOUNT"]: + if key in hdr.header: + del hdr.header[key] + + # Insert all the cards from the file. for k, v, f in hdu_group.groups[hdr_idx]["keyword", "value", "format"]: hdr.header[k] = self.lexical_cast(v, f) hdul.append(hdr)