def test_sorting(self, triage_setup): collection = ImageFileCollection( location=triage_setup.test_dir, keywords=['imagetyp', 'filter', 'object']) all_elements = [] for hdu, fname in collection.hdus(return_fname=True): all_elements.append((str(hdu.header), fname)) # Now sort collection.sort(keys=['imagetyp', 'object']) # and check it's all still right for hdu, fname in collection.hdus(return_fname=True): assert((str(hdu.header), fname) in all_elements) for i in range(len(collection.summary)): assert(collection.summary['file'][i] == collection.files[i])
def test_sorting_without_key_fails(self, triage_setup): ic = ImageFileCollection(location=triage_setup.test_dir) with pytest.raises(ValueError): ic.sort(keys=None)