Skip to content

Commit

Permalink
CI: Update tests.
Browse files Browse the repository at this point in the history
* Switch has_calls to assert_has_calls
* Update tests to match fixes/improvements in prior commits
  • Loading branch information
Gadgetoid committed May 23, 2024
1 parent 7b2acfc commit dcc714e
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def test_get_adc(ioexpander):


def test_read_all(ioexpander):
from mics6814 import MICS6814, Mics6814Reading
from mics6814 import MICS6814, MICS6814_NH3, MICS6814_OX, MICS6814_RED, MICS6814_VREF, Mics6814Reading

mics6814 = MICS6814()

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

assert type(reading) == Mics6814Reading
mics6814._ioe.input.has_calls((
mock.call(9),
mock.call(12),
mock.call(11),
mock.call(13),
mics6814._ioe.input.assert_has_calls((
mock.call(MICS6814_VREF),
mock.call(MICS6814_RED),
mock.call(MICS6814_NH3),
mock.call(MICS6814_OX),
))

assert "Oxidising" in str(reading)
Expand Down Expand Up @@ -115,13 +115,14 @@ def test_read_oxd_red_nh3_zero_division(ioexpander):


def test_set_led(ioexpander):
from mics6814 import MICS6814
from mics6814 import MICS6814, MICS6814_HEATER_EN, MICS6814_LED_B, MICS6814_LED_G, MICS6814_LED_R

mics6814 = MICS6814()
mics6814.set_led(255, 155, 55)

assert mics6814._ioe.output.has_calls((
mock.call(3, 255),
mock.call(7, 155),
mock.call(2, 55)
mics6814._ioe.output.assert_has_calls((
mock.call(MICS6814_HEATER_EN, ioexpander.LOW),
mock.call(MICS6814_LED_R, 0),
mock.call(MICS6814_LED_G, 2000),
mock.call(MICS6814_LED_B, 4000)
))

0 comments on commit dcc714e

Please sign in to comment.