Whole file
undera/pylgbst
The author described this change as “Added test and fix for device matching (#46)”. It counts as a record because the check below fails on the code as it stood at 9e4fab4aa and passes on dff312534, with nothing else changed between the two runs.
Projectundera/pylgbst
Fix saved2020-01-29
Sharing licenceMIT · LICENSE
Change size+10 −3
What the code was meant to do, written into the code itself as a save note
Added test and fix for device matching (#46)
The change
| 48 | 48 | ||
| 49 | 49 | def _is_device_matched(self, address, name, hub_mac): | |
| 50 | 50 | log.debug("Checking device name: %s, MAC: %s", name, address) | |
| 51 | + | matched = False | |
| 51 | 52 | if address != "00:00:00:00:00:00": | |
| 52 | - | if (not hub_mac and name == LEGO_MOVE_HUB) or hub_mac.lower() == address.lower(): | |
| 53 | + | if hub_mac: | |
| 54 | + | if hub_mac.lower() == address.lower(): | |
| 55 | + | matched = True | |
| 56 | + | elif name == LEGO_MOVE_HUB: | |
| 57 | + | matched = True | |
| 58 | + | ||
| 59 | + | if matched: | |
| 53 | 60 | log.info("Found %s at %s", name, address) | |
| 54 | - | return True | |
| 55 | - | return False | |
| 61 | + | ||
| 62 | + | return matched | |
| 56 | 63 | ||
| 57 | 64 | ||
| 58 | 65 | class DebugServer(object): |
The check that tells the two apart
fail→pass·tests/test_comms.py::ConnectionTestCase::test_is_device_matched
Check file tests/test_comms.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before it9e4fab4aaef1a9c02d7577896113af9579699aa3
Broken version dated2020-01-28
Modulepylgbst.comms.__init__
Units changedConnection
Fingerprinteb219324488ed071
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.