def test_wavelength_raises_for_invalid_value(): value = 0 wlm = MockWavelengthMeter(value) channel = Channel(randint(1, 8), wlm=wlm) with pytest.raises(ReadingError) as e: channel.wavelength assert (e.reason)
def test_switcher_channel_sets_active_channel_from_channel_object(): mock_dll = MockDLL(1) wlm = WavelengthMeter(mock_dll) channel = Channel(2, wlm=wlm) wlm.switcher_channel = channel assert(wlm.switcher_channel == 2)
def test_show_returns_show_state(wlm): channel = Channel(randint(1, 8), wlm=wlm) assert (channel.show == False)
def test_use_sets_use_state(wlm): channel = Channel(randint(1, 8), wlm=wlm) channel.use = True
def test_use_returns_use_state(wlm): channel = Channel(randint(1, 8), wlm=wlm) assert (channel.use == False)
def test_state_sets_signal_state(wlm): channel = Channel(randint(1, 8), wlm=wlm) channel.state = {'use': True, 'show': False}
def test_state_returns_signal_state(wlm): channel = Channel(randint(1, 8), wlm=wlm) assert (channel.state == {'use': False, 'show': False})
def test_get_wavelength_returns_value(): value = random() * 1e12 * 700e2 wlm = MockWavelengthMeter(value) channel = Channel(randint(1, 8), wlm=wlm) assert (channel.wavelength == value)
def test_frequency_returns_value(): value = random() * 1e12 * 700e2 wlm = MockWavelengthMeter(value) channel = Channel(randint(1, 8), wlm=wlm) assert (channel.frequency == value)
def test_switch_changes_channel(wlm): num = randint(1, 8) channel = Channel(num, wlm=wlm) channel.switch() assert (channel._wlm.switcher_channel == num)
def test_init_sets_wlm_parent(wlm): channel = Channel(1, wlm=wlm) assert (channel._wlm == wlm)
def test_init_sets_channel_number(wlm): channel = Channel(1, wlm=wlm) assert (channel.num == 1)
def test_show_sets_show_state(wlm): channel = Channel(randint(1, 8), wlm=wlm) channel.show = True