def test_configure_count_time(RE, hw): det = hw.det_with_count_time det.count_time.put(3) def plan(): yield from (m for m in [Msg('read', det)]) msgs = [] def accumulator(msg): msgs.append(msg) RE.msg_hook = accumulator RE(configure_count_time_wrapper(plan(), 7)) expected = [ Msg('set', det.count_time, 7), Msg('wait'), Msg('read', det), Msg('set', det.count_time, 3), Msg('wait') ] for msg in msgs: msg.kwargs.pop('group', None) assert msgs == expected
def test_configure_count_time(RE, hw): det = hw.det_with_count_time det.count_time.put(3) def plan(): yield from (m for m in [Msg('read', det)]) msgs = [] def accumulator(msg): msgs.append(msg) RE.msg_hook = accumulator RE(configure_count_time_wrapper(plan(), 7)) expected = [Msg('set', det.count_time, 7), Msg('wait'), Msg('read', det), Msg('set', det.count_time, 3), Msg('wait')] for msg in msgs: msg.kwargs.pop('group', None) assert msgs == expected