def test_headers_save_location(self, triage_setup):
        collection = ImageFileCollection(location=triage_setup.test_dir,
                                         keywords=['imagetyp'])
        destination = mkdtemp()
        for header in collection.headers(save_location=destination):
            pass
        new_collection = ImageFileCollection(location=destination,
                                             keywords=['imagetyp'])
        basenames = lambda paths: set(
            [os.path.basename(file) for file in paths])

        assert (len(basenames(collection._paths()) -
                    basenames(new_collection._paths())) == 0)
        rmtree(destination)
 def test_generator_headers_save_with_name(self, triage_setup):
     collection = ImageFileCollection(location=triage_setup.test_dir,
                                      keywords=['imagetyp'])
     for header in collection.headers(save_with_name='_new'):
         assert isinstance(header, fits.Header)
     new_collection = ImageFileCollection(location=triage_setup.test_dir,
                                          keywords=['imagetyp'])
     assert (len(new_collection._paths()) ==
             2 * (triage_setup.n_test['files']) -
             triage_setup.n_test['compressed'])
     [os.remove(fil) for fil in iglob(triage_setup.test_dir + '/*_new*')]
    def test_generator_full_path(self, triage_setup):
        collection = ImageFileCollection(
            location=triage_setup.test_dir, keywords=['imagetyp'])

        for path, file_name in zip(collection._paths(), collection.files):
            assert path == os.path.join(triage_setup.test_dir, file_name)