示例#1
0
    def test_remove_module(self):
        pipeline = Pypeline(self.test_dir, self.test_dir, self.test_dir)

        read = FitsReadingModule(name_in='read')
        pipeline.add_module(read)

        process = BadPixelSigmaFilterModule(name_in='badpixel',
                                            image_in_tag='im_arr1',
                                            image_out_tag='im_out')

        pipeline.add_module(process)

        assert pipeline.get_module_names() == ['read', 'badpixel']
        assert pipeline.remove_module('read')

        assert pipeline.get_module_names() == ['badpixel']
        assert pipeline.remove_module('badpixel')

        with pytest.warns(UserWarning) as warning:
            pipeline.remove_module('test')

        assert len(warning) == 1
        assert warning[0].message.args[0] == 'Module name \'test\' not found in the Pypeline ' \
                                             'dictionary.'

        os.remove(self.test_dir + 'PynPoint_database.hdf5')
示例#2
0
    def test_remove_module(self) -> None:

        pipeline = Pypeline(self.test_dir, self.test_dir, self.test_dir)

        module = FitsReadingModule(name_in='read')

        pipeline.add_module(module)

        module = BadPixelSigmaFilterModule(name_in='badpixel',
                                           image_in_tag='im_arr1',
                                           image_out_tag='im_out')

        pipeline.add_module(module)

        assert pipeline.get_module_names() == ['read', 'badpixel']
        assert pipeline.remove_module('read')

        assert pipeline.get_module_names() == ['badpixel']
        assert pipeline.remove_module('badpixel')

        with pytest.warns(UserWarning) as warning:
            pipeline.remove_module('test')

        assert len(warning) == 1

        assert warning[0].message.args[0] == 'Pipeline module \'test\' is not found in the ' \
                                             'Pypeline dictionary so it could not be removed. ' \
                                             'The dictionary contains the following modules: [].' \

        os.remove(self.test_dir + 'PynPoint_database.hdf5')
示例#3
0
    def test_remove_module(self):
        pipeline = Pypeline(self.test_dir, self.test_dir, self.test_dir)

        read = FitsReadingModule(name_in="read")
        pipeline.add_module(read)

        process = BadPixelSigmaFilterModule(name_in="badpixel")
        pipeline.add_module(process)

        assert pipeline.get_module_names() == ["read", "badpixel"]
        assert pipeline.remove_module("read")

        assert pipeline.get_module_names() == ["badpixel"]
        assert pipeline.remove_module("badpixel")

        with pytest.warns(UserWarning) as warning:
            pipeline.remove_module("test")

        assert len(warning) == 1
        assert warning[0].message.args[0] == "Module name 'test' not found in the Pypeline " \
                                             "dictionary."

        os.remove(self.test_dir + "PynPoint_database.hdf5")