Tests for the PCA8574

The PCA8574 is the lowest level component in the application that we developed in Chapter 3, Writing a MicroPython Driver for an I/O Expander. It makes sense that we should develop the test cases for this module first. As I mentioned earlier, preferably, we would do this while we were developing the module, but in this case, we are adding it after the fact. We want to make sure that we test the module effectively for our application. In this case, there are four tests that we want to perform:

  • I2C object creation and initialization
  • I2C object creation handling for out-of-range addresses
  • Lowest Significant Bit (LSB) high read
  • Lowest Significant Bit (LSB) low read

We could design a series of tests that would check every ...

Get MicroPython Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.