Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
csst-pipeline
csst_common
Commits
0da320ef
Commit
0da320ef
authored
1 year ago
by
BO ZHANG
Browse files
Options
Download
Email Patches
Plain Diff
add delete_section
parent
be7eda29
dev
main
No related merge requests found
Pipeline
#5410
failed with stage
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_fits_header_ops.py
+19
-1
tests/test_fits_header_ops.py
with
19 additions
and
1 deletion
+19
-1
tests/test_fits_header_ops.py
+
19
-
1
View file @
0da320ef
...
...
@@ -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
)
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets