def test_refresh_method_sees_added_files(self, triage_setup):
     ic = ImageFileCollection(triage_setup.test_dir, keywords='*')
     # Compressed files don't get copied. Not sure why...
     original_len = len(ic.summary) - triage_setup.n_test['compressed']
     # Generate additional files in this directory
     for h in ic.headers(save_with_name="_foo"):
         pass
     ic.refresh()
     new_len = len(ic.summary) - triage_setup.n_test['compressed']
     assert new_len == 2 * original_len
    def test_refresh_method_sees_added_keywords(self, triage_setup):
        ic = ImageFileCollection(triage_setup.test_dir, keywords='*')
        # Add a keyword I know isn't already in the header to each file.
        not_in_header = 'BARKARK'

        for h in ic.headers(overwrite=True):
            h[not_in_header] = True

        assert not_in_header not in ic.summary.colnames

        ic.refresh()
        # After refreshing the odd keyword should be present.
        assert not_in_header.lower() in ic.summary.colnames
    def test_filenames_are_set_properly(self, triage_setup):
        fn = ['filter_no_object_bias.fit', 'filter_object_light_foo.fit']
        img_collection = ImageFileCollection(
            location=triage_setup.test_dir, filenames=fn, keywords=['filter'])
        assert img_collection.files == fn

        img_collection.refresh()
        assert img_collection.files == fn

        fn = 'filter_no_object_bias.fit'
        img_collection = ImageFileCollection(
            location=triage_setup.test_dir, filenames=fn, keywords=['filter'])
        assert img_collection.files == [fn]