pimoroni / inky

Combined library for V2/V3 Inky pHAT and Inky wHAT.
https://shop.pimoroni.com/?q=inky
MIT License
575 stars 121 forks source link

`InkyMockImpression.set_image` fails with `AttributeError` #166

Closed corranwebster closed 1 year ago

corranwebster commented 1 year ago

When testing image display using InkyMockImpression, calls to set_image fail with the following traceback:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../site-packages/inky/mock.py", line 242, in set_image
    palette = inky_uc8159.Inky._palette_blend(self, saturation)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../site-packages/inky/inky_uc8159.py", line 196, in _palette_blend
    rs, gs, bs = [c * saturation for c in self.SATURATED_PALETTE[i]]
                                          ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'InkyMockImpression' object has no attribute 'SATURATED_PALETTE'

I think that the fix is fairly straightforward in that the appropriate attributes holding the saturated and desaturated palettes need to be added to the class.