Exemplo n.º 1
0
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)
Exemplo n.º 2
0
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)
Exemplo n.º 3
0
def test_show_returns_show_state(wlm):
    channel = Channel(randint(1, 8), wlm=wlm)
    assert (channel.show == False)
Exemplo n.º 4
0
def test_use_sets_use_state(wlm):
    channel = Channel(randint(1, 8), wlm=wlm)
    channel.use = True
Exemplo n.º 5
0
def test_use_returns_use_state(wlm):
    channel = Channel(randint(1, 8), wlm=wlm)
    assert (channel.use == False)
Exemplo n.º 6
0
def test_state_sets_signal_state(wlm):
    channel = Channel(randint(1, 8), wlm=wlm)
    channel.state = {'use': True, 'show': False}
Exemplo n.º 7
0
def test_state_returns_signal_state(wlm):
    channel = Channel(randint(1, 8), wlm=wlm)
    assert (channel.state == {'use': False, 'show': False})
Exemplo n.º 8
0
def test_get_wavelength_returns_value():
    value = random() * 1e12 * 700e2
    wlm = MockWavelengthMeter(value)
    channel = Channel(randint(1, 8), wlm=wlm)

    assert (channel.wavelength == value)
Exemplo n.º 9
0
def test_frequency_returns_value():
    value = random() * 1e12 * 700e2
    wlm = MockWavelengthMeter(value)
    channel = Channel(randint(1, 8), wlm=wlm)

    assert (channel.frequency == value)
Exemplo n.º 10
0
def test_switch_changes_channel(wlm):
    num = randint(1, 8)
    channel = Channel(num, wlm=wlm)
    channel.switch()

    assert (channel._wlm.switcher_channel == num)
Exemplo n.º 11
0
def test_init_sets_wlm_parent(wlm):
    channel = Channel(1, wlm=wlm)
    assert (channel._wlm == wlm)
Exemplo n.º 12
0
def test_init_sets_channel_number(wlm):
    channel = Channel(1, wlm=wlm)
    assert (channel.num == 1)
Exemplo n.º 13
0
def test_show_sets_show_state(wlm):
    channel = Channel(randint(1, 8), wlm=wlm)
    channel.show = True