Commit 0da320ef authored by BO ZHANG's avatar BO ZHANG 🏀
Browse files

add delete_section

parent be7eda29
Pipeline #5410 failed with stage
in 0 seconds
......@@ -8,11 +8,12 @@ Modified-History:
2023-12-15, Bo Zhang, add TestFitsHeaderOps.test_append_header
2023-12-15, Bo Zhang, add TestFitsHeaderOps.test_reformat_header
"""
import unittest
from astropy.io import fits
from csst_common.io import append_header, reformat_header
from csst_common.io import append_header, reformat_header, delete_section
class TestFitsHeaderOps(unittest.TestCase):
......@@ -100,3 +101,20 @@ class TestFitsHeaderOps(unittest.TestCase):
tuple(h_rfmt.keys()),
("COMMENT", "COMMENT", "COMMENT", "A", "SIMPLE", "NAXIS1"),
)
def test_delete_section(self):
h = fits.Header()
h.add_comment("A")
h.add_comment("B")
h.add_comment("C")
h.set("SIMPLE", True)
h.set("NAXIS1", 1)
h.add_comment("======")
h.add_comment("WCS")
h.add_comment("======")
h.set("A", 1)
h.add_comment("======")
h.add_comment("======")
h_del = delete_section(h, title="WCS")
self.assertEqual(len(h_del.cards), 7)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment