Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_add_wrong_module(self) -> None:
pipeline = Pypeline(self.test_dir, self.test_dir, self.test_dir)
with pytest.raises(TypeError) as error:
pipeline.add_module(None)
assert str(error.value) == 'type of argument "module" must be ' \
'pynpoint.core.processing.PypelineModule; got NoneType instead'
os.remove(self.test_dir+'PynPoint_database.hdf5')
def setup_class(self) -> None:
self.limit = 1e-10
self.test_dir = os.path.dirname(__file__) + '/'
create_star_data(self.test_dir+'images')
create_config(self.test_dir+'PynPoint_config.ini')
self.pipeline = Pypeline(self.test_dir, self.test_dir, self.test_dir)
def setup_class(self) -> None:
self.limit = 1e-10
self.test_dir = os.path.dirname(__file__) + '/'
create_star_data(self.test_dir+'data1')
create_star_data(self.test_dir+'data2')
create_star_data(self.test_dir+'data3')
create_config(self.test_dir+'PynPoint_config.ini')
self.pipeline = Pypeline(self.test_dir, self.test_dir, self.test_dir)
def setup_class(self) -> None:
self.limit = 1e-10
self.test_dir = os.path.dirname(__file__) + '/'
create_star_data(self.test_dir+'data')
create_config(self.test_dir+'PynPoint_config.ini')
self.pipeline = Pypeline(self.test_dir, self.test_dir, self.test_dir)
def test_create_pipeline_path_missing(self) -> None:
dir_non_exists = self.test_dir + 'none/'
dir_exists = self.test_dir
with pytest.raises(AssertionError) as error:
Pypeline(dir_non_exists, dir_exists, dir_exists)
assert str(error.value) == 'Input directory for _m_working_place does not exist ' \
'- input requested: '+self.test_dir+'none/.'
with pytest.raises(AssertionError) as error:
Pypeline(dir_exists, dir_non_exists, dir_exists)
assert str(error.value) == 'Input directory for _m_input_place does not exist ' \
'- input requested: '+self.test_dir+'none/.'
with pytest.raises(AssertionError) as error:
Pypeline(dir_exists, dir_exists, dir_non_exists)
assert str(error.value) == 'Input directory for _m_output_place does not exist ' \
'- input requested: '+self.test_dir+'none/.'
with pytest.raises(AssertionError) as error:
Pypeline()
assert str(error.value) == 'Input directory for _m_working_place does not exist ' \
'- input requested: None.'
def test_get_tags(self) -> None:
pipeline = Pypeline(self.test_dir, self.test_dir, self.test_dir)
assert pipeline.get_tags() == 'images'
dir_exists = self.test_dir
with pytest.raises(AssertionError) as error:
Pypeline(dir_non_exists, dir_exists, dir_exists)
assert str(error.value) == 'Input directory for _m_working_place does not exist ' \
'- input requested: '+self.test_dir+'none/.'
with pytest.raises(AssertionError) as error:
Pypeline(dir_exists, dir_non_exists, dir_exists)
assert str(error.value) == 'Input directory for _m_input_place does not exist ' \
'- input requested: '+self.test_dir+'none/.'
with pytest.raises(AssertionError) as error:
Pypeline(dir_exists, dir_exists, dir_non_exists)
assert str(error.value) == 'Input directory for _m_output_place does not exist ' \
'- input requested: '+self.test_dir+'none/.'
with pytest.raises(AssertionError) as error:
Pypeline()
assert str(error.value) == 'Input directory for _m_working_place does not exist ' \
'- input requested: None.'
def test_run_module_wrong_tag(self) -> None:
pipeline = Pypeline(self.test_dir, self.test_dir, self.test_dir)
module = FitsReadingModule(name_in='read')
pipeline.add_module(module)
module = FitsWritingModule(name_in='write',
file_name='result.fits',
data_tag='im_list')
pipeline.add_module(module)
module = BadPixelSigmaFilterModule(name_in='badpixel',
image_in_tag='im_list',
image_out_tag='im_out')
pipeline.add_module(module)
def setup_class(self) -> None:
self.limit = 1e-10
self.test_dir = os.path.dirname(__file__) + '/'
create_star_data(self.test_dir+'self.limits', npix=21, pos_star=10.)
create_config(self.test_dir+'PynPoint_config.ini')
self.pipeline = Pypeline(self.test_dir, self.test_dir, self.test_dir)
def test_delete_not_found(self) -> None:
pipeline = Pypeline(self.test_dir, self.test_dir, self.test_dir)
with pytest.warns(UserWarning) as warning:
pipeline.delete_data('images')
assert len(warning) == 2
assert warning[0].message.args[0] == 'Dataset \'images\' not found in the database.'
assert warning[1].message.args[0] == 'Attributes of \'images\' not found in the database.'