kplindegaard / smbus2

A drop-in replacement for smbus-cffi/smbus-python in pure Python
MIT License
243 stars 68 forks source link

Use decode to convert __bytes__ to __str__ #45

Closed Sh3Rm4n closed 4 years ago

Sh3Rm4n commented 4 years ago

The test did not cover the case, when the byte can not be decoded via 'chr'. For the sake of simplicity, just use the 'decode' bytes method and ignore non-utf-8 characters, so no error will be thrown.

Arguably, these could also replaced with ''''.

Sh3Rm4n commented 4 years ago

tox won't run the python2 tests on my machine, because it fails installing mock which dropped it's python2 support in v4.0.

kplindegaard commented 4 years ago

Anyway, your PR passed the travis-ci tests, so it should be fine.