Context
The new example validation test suite (PR #213) detected 2 examples calling methods that don't exist in their respective drivers.
Bugs
1. lib/lis2mdl/examples/magnet_test.py
Calls mag.read_reg() (28 occurrences) but the method in device.py is _read_reg() (private, with underscore prefix).
Fix: Either expose a public read_reg() method in the driver, or replace calls with mag._read_reg() in the example (acceptable since this is a low-level test/debug script).
2. lib/wsen-pads/examples/test.py
Calls sensor._read_u8() (5 occurrences) but this method doesn't exist in wsen_pads/device.py. The driver uses _read_reg() instead.
Fix: Replace sensor._read_u8(reg) with sensor._read_reg(reg).
Verification
After fixing, run:
python3 -m pytest tests/test_examples.py -v -k "magnet_test or wsen-pads/test"
Both tests should pass.
Checklist
Context
The new example validation test suite (PR #213) detected 2 examples calling methods that don't exist in their respective drivers.
Bugs
1.
lib/lis2mdl/examples/magnet_test.pyCalls
mag.read_reg()(28 occurrences) but the method indevice.pyis_read_reg()(private, with underscore prefix).Fix: Either expose a public
read_reg()method in the driver, or replace calls withmag._read_reg()in the example (acceptable since this is a low-level test/debug script).2.
lib/wsen-pads/examples/test.pyCalls
sensor._read_u8()(5 occurrences) but this method doesn't exist inwsen_pads/device.py. The driver uses_read_reg()instead.Fix: Replace
sensor._read_u8(reg)withsensor._read_reg(reg).Verification
After fixing, run:
python3 -m pytest tests/test_examples.py -v -k "magnet_test or wsen-pads/test"Both tests should pass.
Checklist
lib/lis2mdl/examples/magnet_test.py— replaceread_reg()with_read_reg()lib/wsen-pads/examples/test.py— replace_read_u8()with_read_reg()