From e6464dc7614c27de3c54ba55cada3c6dd584752c Mon Sep 17 00:00:00 2001 From: Brendan <2bndy5@gmail.com> Date: Wed, 7 Aug 2024 03:41:00 -0700 Subject: [PATCH] reduce lines in test source --- tests/test_i2c.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/tests/test_i2c.py b/tests/test_i2c.py index 9796e4e..b2bedcc 100644 --- a/tests/test_i2c.py +++ b/tests/test_i2c.py @@ -19,21 +19,17 @@ def test_singleton(board_i2c: busio.I2C, busio_i2c: busio.I2C): assert isinstance(board_i2c.expectations, deque) assert board_i2c == busio_i2c - board_i2c.expectations.extend( - [ - I2CScan([address]), - I2CTransfer(address, bytearray(1), bytearray(1)), - ] - ) + board_i2c.expectations.append(I2CScan([address])) + board_i2c.expectations.append(I2CTransfer(address, bytearray(1), bytearray(1))) assert busio_i2c.expectations == board_i2c.expectations assert busio_i2c.try_lock() + assert not board_i2c.try_lock() assert address in board_i2c.scan() busio_i2c.unlock() buffer = bytearray(1) assert board_i2c.try_lock() - assert not busio_i2c.try_lock() board_i2c.writeto_then_readfrom(address, buffer, buffer) board_i2c.unlock() busio_i2c.unlock() # for coverage measurement only