Debian Codegraph @

tests/test_manualswitchdriver.py

raw symbols SCIP
1 import pytest
2
3 from labgrid.driver.manualswitchdriver import ManualSwitchDriver
4
5
6 class TestManualSwitchDriver:
7 def test_create(self, target):
8 d = ManualSwitchDriver(target, "foo-switch")
9 assert isinstance(d, ManualSwitchDriver)
10
11 def test_set_on(self, target, mocker):
12 m = mocker.patch("builtins.input")
13
14 d = ManualSwitchDriver(target, "foo-switch")
15 target.activate(d)
16 d.set(True)
17
18 m.assert_called_once_with("Set foo-switch for target Test to ON and press enter")
19
20 def test_set_off(self, target, mocker):
21 m = mocker.patch("builtins.input")
22
23 d = ManualSwitchDriver(target, "foo-switch")
24 target.activate(d)
25 d.set(False)
26
27 m.assert_called_once_with("Set foo-switch for target Test to OFF and press enter")
28
29 def test_get(self, target, mocker):
30 m = mocker.patch("builtins.input")
31
32 d = ManualSwitchDriver(target, "foo-switch")
33 target.activate(d)
34
35 d.set(True)
36 assert d.get() is True
37
38 d.set(False)
39 assert d.get() is False