Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
csst-dfs
csst-dfs-api-local
Commits
ad1d3c4b
Commit
ad1d3c4b
authored
Mar 24, 2021
by
Wei Shoulin
Browse files
uncomment
parent
a0ca5a82
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/test_ifs_result0.py
View file @
ad1d3c4b
...
@@ -9,25 +9,25 @@ class IFSResult0TestCase(unittest.TestCase):
...
@@ -9,25 +9,25 @@ class IFSResult0TestCase(unittest.TestCase):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
api
=
Result0Api
()
self
.
api
=
Result0Api
()
#
def test_find(self):
def
test_find
(
self
):
#
recs = self.api.find(file_name='CCD2_ObsTime_1200_ObsNum_40.fits')
recs
=
self
.
api
.
find
(
file_name
=
'CCD2_ObsTime_1200_ObsNum_40.fits'
)
#
print('find:', recs)
print
(
'find:'
,
recs
)
#
assert len(recs) == 1
assert
len
(
recs
)
==
1
#
recs = self.api.find()
recs
=
self
.
api
.
find
()
#
print('find:', recs)
print
(
'find:'
,
recs
)
#
assert len(recs) > 1
assert
len
(
recs
)
>
1
#
def test_read(self):
def
test_read
(
self
):
#
recs = self.api.find(file_name='CCD2_ObsTime_1200_ObsNum_40.fits')
recs
=
self
.
api
.
find
(
file_name
=
'CCD2_ObsTime_1200_ObsNum_40.fits'
)
#
print("The full path: ", os.path.join(self.api.root_dir, recs[0]['file_path']))
print
(
"The full path: "
,
os
.
path
.
join
(
self
.
api
.
root_dir
,
recs
[
0
][
'file_path'
]))
#
file_segments = self.api.read(file_path=recs[0]['file_path'])
file_segments
=
self
.
api
.
read
(
file_path
=
recs
[
0
][
'file_path'
])
#
file_bytes = b''.join(file_segments)
file_bytes
=
b
''
.
join
(
file_segments
)
#
hdul = fits.HDUList.fromstring(file_bytes)
hdul
=
fits
.
HDUList
.
fromstring
(
file_bytes
)
#
print(hdul.info())
print
(
hdul
.
info
())
#
hdr = hdul[0].header
hdr
=
hdul
[
0
].
header
#
print(repr(hdr))
print
(
repr
(
hdr
))
def
test_write
(
self
):
def
test_write
(
self
):
self
.
api
.
write
(
raw_id
=
1
,
self
.
api
.
write
(
raw_id
=
1
,
...
...
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