mirror of
https://github.com/google/bumble.git
synced 2026-05-08 03:58:01 +00:00
avdtp: address review nits — use truthy checks
Per @zxzxwu review on #918: - bumble/avdtp.py: replace `if len(pdu) < 1:` with `if not pdu:` - tests/avdtp_test.py: replace `assert completed == []` with `assert not completed` Both are idiomatic Python truthy checks; behavior identical.
This commit is contained in:
@@ -314,7 +314,7 @@ class MessageAssembler:
|
||||
# Drop empty PDUs sent by remote — accessing pdu[0] below would
|
||||
# raise IndexError, propagating up to the L2CAP read loop and
|
||||
# tearing down the channel. Same class as #912 (ATT empty PDU).
|
||||
if len(pdu) < 1:
|
||||
if not pdu:
|
||||
logger.warning('AVDTP message assembler: empty PDU dropped')
|
||||
return
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ def test_message_assembler_truncated_pdu(pdu: bytes):
|
||||
assembler = avdtp.MessageAssembler(callback)
|
||||
# Must not raise; nothing should be delivered to callback either.
|
||||
assembler.on_pdu(pdu)
|
||||
assert completed == []
|
||||
assert not completed
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user