Skip to content

Commit 7220ddd

Browse files
committed
CI: Update tests.
* Switch has_calls to assert_has_calls * Update tests to match fixes/improvements in prior commits
1 parent 7b2acfc commit 7220ddd

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

tests/test_io.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def test_get_adc(ioexpander):
6868

6969

7070
def test_read_all(ioexpander):
71-
from mics6814 import MICS6814, Mics6814Reading
71+
from mics6814 import MICS6814, Mics6814Reading, MICS6814_VREF, MICS6814_RED, MICS6814_NH3, MICS6814_OX
7272

7373
mics6814 = MICS6814()
7474

@@ -78,11 +78,11 @@ def test_read_all(ioexpander):
7878
reading = mics6814.read_all()
7979

8080
assert type(reading) == Mics6814Reading
81-
mics6814._ioe.input.has_calls((
82-
mock.call(9),
83-
mock.call(12),
84-
mock.call(11),
85-
mock.call(13),
81+
mics6814._ioe.input.assert_has_calls((
82+
mock.call(MICS6814_VREF),
83+
mock.call(MICS6814_RED),
84+
mock.call(MICS6814_NH3),
85+
mock.call(MICS6814_OX),
8686
))
8787

8888
assert "Oxidising" in str(reading)
@@ -115,13 +115,14 @@ def test_read_oxd_red_nh3_zero_division(ioexpander):
115115

116116

117117
def test_set_led(ioexpander):
118-
from mics6814 import MICS6814
118+
from mics6814 import MICS6814, MICS6814_HEATER_EN, MICS6814_LED_R, MICS6814_LED_G, MICS6814_LED_B
119119

120120
mics6814 = MICS6814()
121121
mics6814.set_led(255, 155, 55)
122122

123-
assert mics6814._ioe.output.has_calls((
124-
mock.call(3, 255),
125-
mock.call(7, 155),
126-
mock.call(2, 55)
123+
mics6814._ioe.output.assert_has_calls((
124+
mock.call(MICS6814_HEATER_EN, ioexpander.LOW),
125+
mock.call(MICS6814_LED_R, 0),
126+
mock.call(MICS6814_LED_G, 2000),
127+
mock.call(MICS6814_LED_B, 4000)
127128
))

0 commit comments

Comments
 (0)