Skip to content

Commit c1f0855

Browse files
davidgltbsipocz
authored andcommitted
Include offline test for product_type as a list
1 parent ec3f48b commit c1f0855

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

astroquery/esa/jwst/tests/test_jwsttap.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,37 @@ def test_get_obs_products(self):
733733
finally:
734734
shutil.rmtree(output_file_full_path_dir)
735735

736+
# Test product_type paramater with a list
737+
output_file_full_path_dir = os.getcwd() + os.sep + "temp_test_jwsttap_get_obs_products_1"
738+
try:
739+
os.makedirs(output_file_full_path_dir, exist_ok=True)
740+
except OSError as err:
741+
print(f"Creation of the directory {output_file_full_path_dir} failed: {err.strerror}")
742+
raise err
743+
744+
file = data_path('single_product_retrieval.tar')
745+
output_file_full_path = output_file_full_path_dir + os.sep + os.path.basename(file)
746+
shutil.copy(file, output_file_full_path)
747+
parameters['output_file'] = output_file_full_path
748+
749+
expected_files = []
750+
extracted_file_1 = output_file_full_path_dir + os.sep + 'single_product_retrieval_1.fits'
751+
expected_files.append(extracted_file_1)
752+
product_type_as_list = ['science', 'info']
753+
try:
754+
files_returned = (jwst.get_obs_products(
755+
observation_id=observation_id,
756+
cal_level='ALL',
757+
product_type=product_type_as_list,
758+
output_file=output_file_full_path))
759+
parameters['params_dict']['product_type'] = 'science,info'
760+
dummyTapHandler.check_call('load_data', parameters)
761+
self.__check_extracted_files(files_expected=expected_files,
762+
files_returned=files_returned)
763+
finally:
764+
shutil.rmtree(output_file_full_path_dir)
765+
del parameters['params_dict']['product_type']
766+
736767
# Test single file
737768
output_file_full_path_dir = os.getcwd() + os.sep +\
738769
"temp_test_jwsttap_get_obs_products_2"

0 commit comments

Comments
 (0)