from gwpy.io.datafind import find_best_frametype
from gwpy.time import to_gps


class TestChannel:

    def test_get_frame_type(self):
        chans = {'L1:GDS-CALIB_STRAIN': 'L1_llhoft', 'L1:LSC-DARM_IN1_DQ': 'L1_R'}
        now = to_gps('now')
        good_time = now - 5 * 3600
        for chan, ftype in chans.items():
            rtype = find_best_frametype(chan, good_time, good_time+1)
            assert rtype == ftype
