@@ -21,9 +21,7 @@ def mock_serial():
2121
2222
2323def test_constructor () -> None :
24- t = SMPSerialTransport (
25- max_smp_encoded_frame_size = 512 , line_length = 128 , line_buffers = 4
26- )
24+ t = SMPSerialTransport (max_smp_encoded_frame_size = 512 , line_length = 128 , line_buffers = 4 )
2725 assert t .mtu == 512
2826 assert t .max_unencoded_size < 512
2927
@@ -71,9 +69,7 @@ async def test_send() -> None:
7169
7270 await t .send (r .BYTES )
7371 t ._conn .write .assert_called_once ()
74- assert (
75- p .call_count == 2
76- ) # called twice since out buffer was not drained on first call
72+ assert p .call_count == 2 # called twice since out buffer was not drained on first call
7773
7874
7975@pytest .mark .asyncio
@@ -256,10 +252,7 @@ async def test_disconnect_flushes_partial_smp_as_serial(
256252 await t .disconnect ()
257253 messages = {r .message for r in caplog .records }
258254 assert "/dev/ttyACM0: Normal serial" in messages
259- assert any (
260- b"AAAA" in r .message .encode ("utf-8" , errors = "ignore" )
261- for r in caplog .records
262- )
255+ assert any (b"AAAA" in r .message .encode ("utf-8" , errors = "ignore" ) for r in caplog .records )
263256
264257
265258@pytest .mark .asyncio
@@ -280,16 +273,11 @@ async def bad_callback(data: bytes) -> None:
280273 t = SMPSerialTransport (serial_line_callback = bad_callback )
281274 await t .connect ("/dev/ttyACM0" , timeout_s = 1.0 )
282275
283- t ._conn .read_all = MagicMock ( # type: ignore
284- side_effect = [b"Line 1\n " , b"Line 2\n " ]
285- )
276+ t ._conn .read_all = MagicMock (side_effect = [b"Line 1\n " , b"Line 2\n " ]) # type: ignore
286277
287278 with caplog .at_level (logging .ERROR ):
288279 await asyncio .sleep (0.05 ) # Flush mock serial.
289- assert any (
290- "Serial data callback raised an exception" in r .message
291- for r in caplog .records
292- )
280+ assert any ("Serial data callback raised an exception" in r .message for r in caplog .records )
293281
294282 await t .disconnect ()
295283
0 commit comments